proxy: optimize NewConn, avoid loop

This commit is contained in:
nadoo committed 2020-10-11 18:46:15 +08:00
1 parent 40ddd1be3a
commit 6fff126e4b
6 files changed
+14 -13

No files matched your search

+3
View File
@@ -28,6 +28,9 @@ type Conn struct {
// NewConn returns a new conn.
func NewConn(c net.Conn) *Conn {
if conn, ok := c.(*Conn); ok {
return conn
}
return &Conn{bufio.NewReader(c), c}
}