1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-29 17:41:15 +03:00

Separate read and write buffers for PubSub.

This commit is contained in:
Vladimir Mihailenco
2017-02-19 09:42:45 +02:00
parent a40c8d17fe
commit 6b6f5ca133
5 changed files with 12 additions and 13 deletions

View File

@ -21,12 +21,11 @@ type Conn struct {
}
func NewConn(netConn net.Conn) *Conn {
buf := make([]byte, 4096)
cn := &Conn{
netConn: netConn,
Wb: proto.NewWriteBuffer(buf),
Wb: proto.NewWriteBuffer(),
}
cn.Rd = proto.NewReader(cn.netConn, buf)
cn.Rd = proto.NewReader(cn.netConn)
cn.SetUsedAt(time.Now())
return cn
}