Improve: avoid bufconn twice (#1650)

This commit is contained in:
bobo liu 2021-09-28 23:15:53 +08:00 committed by GitHub
parent 70c8605cca
commit 9aeb4c8cfe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,6 +11,9 @@ type BufferedConn struct {
}
func NewBufferedConn(c net.Conn) *BufferedConn {
if bc, ok := c.(*BufferedConn); ok {
return bc
}
return &BufferedConn{bufio.NewReader(c), c}
}