Skip to content

Commit

Permalink
Improve: avoid bufconn twice (#1650)
Browse files Browse the repository at this point in the history
  • Loading branch information
fakeboboliu authored Sep 28, 2021
1 parent 70c8605 commit 9aeb4c8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions common/net/bufconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}

Expand Down

0 comments on commit 9aeb4c8

Please sign in to comment.