mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-11-01 20:42:32 +08:00
Fix: defer func for safeConnClose (#309)
This commit is contained in:
@@ -36,7 +36,9 @@ func (ss *Socks4) DialContext(ctx context.Context, metadata *M.Metadata) (c net.
|
||||
}
|
||||
setKeepAlive(c)
|
||||
|
||||
defer safeConnClose(c, err)
|
||||
defer func(c net.Conn) {
|
||||
safeConnClose(c, err)
|
||||
}(c)
|
||||
|
||||
err = socks4.ClientHandshake(c, metadata.DestinationAddress(), socks4.CmdConnect, ss.userID)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user