use SO_REUSEADDR in accept loop
This commit is contained in:
parent
1b315f0eee
commit
ca88330b4d
|
@ -48,6 +48,7 @@ proc acceptConnections(punchd: Punchd, ip: IpAddress, port: Port,
|
||||||
else:
|
else:
|
||||||
assert(false, "can only accept TCP or UDP connections")
|
assert(false, "can only accept TCP or UDP connections")
|
||||||
let sock = newAsyncSocket(sockType = sockType, protocol = protocol)
|
let sock = newAsyncSocket(sockType = sockType, protocol = protocol)
|
||||||
|
sock.setSockOpt(OptReuseAddr, true)
|
||||||
sock.bindAddr(port, $ip)
|
sock.bindAddr(port, $ip)
|
||||||
sock.listen()
|
sock.listen()
|
||||||
while true:
|
while true:
|
||||||
|
|
Loading…
Reference in New Issue