mirror of
https://github.com/redis/go-redis.git
synced 2025-07-29 17:41:15 +03:00
Extract race tests to separate file. Add more race tests.
This commit is contained in:
@ -2,6 +2,7 @@ package pool
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"io"
|
||||
"net"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
@ -78,6 +79,17 @@ func (cn *Conn) RemoteAddr() net.Addr {
|
||||
return cn.NetConn.RemoteAddr()
|
||||
}
|
||||
|
||||
func (cn *Conn) ReadN(n int) ([]byte, error) {
|
||||
if d := n - cap(cn.Buf); d > 0 {
|
||||
cn.Buf = cn.Buf[:cap(cn.Buf)]
|
||||
cn.Buf = append(cn.Buf, make([]byte, d)...)
|
||||
} else {
|
||||
cn.Buf = cn.Buf[:n]
|
||||
}
|
||||
_, err := io.ReadFull(cn.Rd, cn.Buf)
|
||||
return cn.Buf, err
|
||||
}
|
||||
|
||||
func (cn *Conn) Close() error {
|
||||
return cn.NetConn.Close()
|
||||
}
|
||||
|
Reference in New Issue
Block a user