1
0
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:
Vladimir Mihailenco
2016-03-16 16:57:24 +02:00
parent 9d394cc7fb
commit f47fb47df0
19 changed files with 411 additions and 330 deletions

View File

@ -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()
}