mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
Use single read and write buffer where possible
This commit is contained in:
@ -14,7 +14,7 @@ type Conn struct {
|
||||
netConn net.Conn
|
||||
|
||||
Rd *proto.Reader
|
||||
Wb *proto.WriteBuffer
|
||||
WB *proto.WriteBuffer
|
||||
|
||||
Inited bool
|
||||
usedAt atomic.Value
|
||||
@ -23,9 +23,10 @@ type Conn struct {
|
||||
func NewConn(netConn net.Conn) *Conn {
|
||||
cn := &Conn{
|
||||
netConn: netConn,
|
||||
Wb: proto.NewWriteBuffer(),
|
||||
}
|
||||
cn.Rd = proto.NewReader(cn.netConn)
|
||||
buf := proto.NewBufioReader(netConn)
|
||||
cn.Rd = proto.NewReader(buf)
|
||||
cn.WB = proto.NewWriteBuffer(buf)
|
||||
cn.SetUsedAt(time.Now())
|
||||
return cn
|
||||
}
|
||||
|
Reference in New Issue
Block a user