chore: better safeConnClose

This commit is contained in:
wwqgtxx
2022-12-16 22:15:44 +08:00
parent 432c4c2cf1
commit 57592ee840
8 changed files with 18 additions and 18 deletions

View File

@ -71,9 +71,9 @@ func (ss *Socks5) DialContext(ctx context.Context, metadata *C.Metadata, opts ..
}
tcpKeepAlive(c)
defer func() {
defer func(c net.Conn) {
safeConnClose(c, err)
}()
}(c)
c, err = ss.StreamConn(c, metadata)
if err != nil {
@ -99,9 +99,9 @@ func (ss *Socks5) ListenPacketContext(ctx context.Context, metadata *C.Metadata,
c = cc
}
defer func() {
defer func(c net.Conn) {
safeConnClose(c, err)
}()
}(c)
tcpKeepAlive(c)
var user *socks5.User