From 24b388f4dd5a56aaf344928a52be54fb094cb6ee Mon Sep 17 00:00:00 2001 From: gVisor bot 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 cb7433d2..a50c7f03 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} }