conn: close old fd before trying again
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
484a9fd324
commit
aabc3770ba
|
@ -99,6 +99,7 @@ again:
|
|||
|
||||
bind.ipv6, port, err = listenNet("udp6", port)
|
||||
if uport == 0 && err != nil && errors.Is(err, syscall.EADDRINUSE) && tries < 100 {
|
||||
bind.ipv4.Close()
|
||||
tries++
|
||||
goto again
|
||||
}
|
||||
|
|
|
@ -123,6 +123,7 @@ again:
|
|||
bind.sock4, newPort, err = create4(port)
|
||||
if err != nil {
|
||||
if originalPort == 0 && err == syscall.EADDRINUSE && tries < 100 {
|
||||
unix.Close(bind.sock6)
|
||||
tries++
|
||||
goto again
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue