chore: reduce wrapper

This commit is contained in:
Skyxim 2022-07-05 21:00:41 +08:00
parent baee951657
commit 56fae0b1f5

View file

@ -16,10 +16,15 @@ type ConnContext struct {
func NewConnContext(conn net.Conn, metadata *C.Metadata) *ConnContext { func NewConnContext(conn net.Conn, metadata *C.Metadata) *ConnContext {
id, _ := uuid.NewV4() id, _ := uuid.NewV4()
if _, ok := conn.(*CN.BufferedConn); !ok {
conn = CN.NewBufferedConn(conn)
}
return &ConnContext{ return &ConnContext{
id: id, id: id,
metadata: metadata, metadata: metadata,
conn: CN.NewBufferedConn(conn), conn: conn,
} }
} }