mirror of
https://git.zx2c4.com/wireguard-go
synced 2024-11-15 01:05:15 +01:00
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)
|
bind.ipv6, port, err = listenNet("udp6", port)
|
||||||
if uport == 0 && err != nil && errors.Is(err, syscall.EADDRINUSE) && tries < 100 {
|
if uport == 0 && err != nil && errors.Is(err, syscall.EADDRINUSE) && tries < 100 {
|
||||||
|
bind.ipv4.Close()
|
||||||
tries++
|
tries++
|
||||||
goto again
|
goto again
|
||||||
}
|
}
|
||||||
|
@ -123,6 +123,7 @@ again:
|
|||||||
bind.sock4, newPort, err = create4(port)
|
bind.sock4, newPort, err = create4(port)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if originalPort == 0 && err == syscall.EADDRINUSE && tries < 100 {
|
if originalPort == 0 && err == syscall.EADDRINUSE && tries < 100 {
|
||||||
|
unix.Close(bind.sock6)
|
||||||
tries++
|
tries++
|
||||||
goto again
|
goto again
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user