close socket on timeout
This commit is contained in:
parent
383260c95e
commit
699f8306c2
|
@ -79,7 +79,7 @@ method initiate*(puncher: TcpNutssPuncher, attempt: Attempt,
|
||||||
try:
|
try:
|
||||||
let acceptFuture = attempt.acceptFuture.get()
|
let acceptFuture = attempt.acceptFuture.get()
|
||||||
await injectSynPackets(attempt)
|
await injectSynPackets(attempt)
|
||||||
await progress("")
|
await progress("") # FIXME: await means we wait until the rendezvous server replied
|
||||||
await acceptFuture or sleepAsync(Timeout)
|
await acceptFuture or sleepAsync(Timeout)
|
||||||
if acceptFuture.finished():
|
if acceptFuture.finished():
|
||||||
result = acceptFuture.read()
|
result = acceptFuture.read()
|
||||||
|
|
1
udp.nim
1
udp.nim
|
@ -41,6 +41,7 @@ proc doInitiate(srcIp: IpAddress, srcPort: Port, dstIp: IpAddress,
|
||||||
await sock.send("ACK")
|
await sock.send("ACK")
|
||||||
initiateFuture.complete(sock)
|
initiateFuture.complete(sock)
|
||||||
else:
|
else:
|
||||||
|
sock.close()
|
||||||
echo &"connection {srcIp}:{srcPort.int} -> {dstIp}:{dstPort.int} timed out"
|
echo &"connection {srcIp}:{srcPort.int} -> {dstIp}:{dstPort.int} timed out"
|
||||||
|
|
||||||
proc doRespond(srcIp: IpAddress, srcPort: Port, dstIp: IpAddress,
|
proc doRespond(srcIp: IpAddress, srcPort: Port, dstIp: IpAddress,
|
||||||
|
|
Loading…
Reference in New Issue