Improve: avoid bufconn twice (#1650)

This commit is contained in:
yaling888 2021-09-30 04:11:37 +08:00 committed by GitHub
commit d29d824da8
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}
}