Fix: hot recreate socks should ignore when receive same address
This commit is contained in:
parent
73ce51bc76
commit
b0ae341bfa
1 changed files with 11 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue