From 1f16800b733ebf36024e9a3aadb208420f6190e2 Mon Sep 17 00:00:00 2001 From: Christian Ulrich Date: Tue, 6 Oct 2020 23:27:48 +0200 Subject: [PATCH] always close sockets --- tcp_syni.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tcp_syni.nim b/tcp_syni.nim index dd2dd0f..8e66def 100644 --- a/tcp_syni.nim +++ b/tcp_syni.nim @@ -186,7 +186,7 @@ proc doConnect(srcIp: IpAddress, srcPort: Port, dstIp: IpAddress, dstPort: Port, future.complete(sock) except OSError as e: echo &"connection {srcIP}:{srcPort.int} -> {dstIp}:{dstPort.int} failed: ", e.msg - discard + sock.close() proc connect*(puncher: TcpSyniPuncher, srcPort: Port, dstIp: IpAddress, dstPorts: seq[Port], @@ -230,7 +230,7 @@ proc prepareAccept(attempt: AcceptAttempt) {.async.} = await connectFuture or sleepAsync(Timeout) if connectFuture.finished(): echo "connected during accept phase" - sock.close() + sock.close() except OSError: discard