From 76bda049b5640ab193754a7f8534b6378c73d742 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Tue, 5 Jul 2022 21:00:41 +0800 Subject: [PATCH] chore: reduce wrapper --- context/conn.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/context/conn.go b/context/conn.go index 8ecbf56b..71ec232e 100644 --- a/context/conn.go +++ b/context/conn.go @@ -16,10 +16,15 @@ type ConnContext struct { func NewConnContext(conn net.Conn, metadata *C.Metadata) *ConnContext { id, _ := uuid.NewV4() + + if _, ok := conn.(*CN.BufferedConn); !ok { + conn = CN.NewBufferedConn(conn) + } + return &ConnContext{ id: id, metadata: metadata, - conn: CN.NewBufferedConn(conn), + conn: conn, } }