From 9aeb4c8cfe83e77caef46594e27797dd8f30bec3 Mon Sep 17 00:00:00 2001 From: bobo liu <7552030+fakeboboliu@users.noreply.github.com> Date: Tue, 28 Sep 2021 23:15:53 +0800 Subject: [PATCH] Improve: avoid bufconn twice (#1650) --- common/net/bufconn.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/net/bufconn.go b/common/net/bufconn.go index cb7433d2e..a50c7f030 100644 --- a/common/net/bufconn.go +++ b/common/net/bufconn.go @@ -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} }