diff --git a/proxy/listener.go b/proxy/listener.go index 9e7d0311..79741581 100644 --- a/proxy/listener.go +++ b/proxy/listener.go @@ -74,10 +74,15 @@ func ReCreateHTTP(port int) error { func ReCreateSocks(port int) error { addr := genAddr(bindAddress, port, allowLan) + shouldTCPIgnore := false + shouldUDPIgnore := false + if socksListener != nil { if socksListener.Address() != addr { socksListener.Close() socksListener = nil + } else { + shouldTCPIgnore = true } } @@ -85,9 +90,15 @@ func ReCreateSocks(port int) error { if socksUDPListener.Address() != addr { socksUDPListener.Close() socksUDPListener = nil + } else { + shouldUDPIgnore = true } } + if shouldTCPIgnore && shouldUDPIgnore { + return nil + } + if portIsZero(addr) { return nil }