cosmetic changes; add FIXMEs

This commit is contained in:
Christian Ulrich 2020-10-14 20:51:32 +02:00
parent 38c935a573
commit 9fac0cec0e
No known key found for this signature in database
GPG Key ID: 8241BE099775A097
2 changed files with 4 additions and 4 deletions

View File

@ -54,7 +54,7 @@ proc doAccept(puncher: TcpSyniAcceptPuncher, srcIp: IpAddress,
srcPort: Port) {.async.} = srcPort: Port) {.async.} =
let sock = newAsyncSocket() let sock = newAsyncSocket()
sock.setSockOpt(OptReuseAddr, true) sock.setSockOpt(OptReuseAddr, true)
sock.bindAddr(srcPort, $(srcIp)) sock.bindAddr(srcPort, $srcIp)
sock.listen() sock.listen()
while true: while true:
let acceptFuture = sock.accept() let acceptFuture = sock.accept()
@ -96,10 +96,10 @@ proc accept*(puncher: TcpSyniAcceptPuncher, srcPort: Port, dstIp: IpAddress,
seqNums: seqNums, seqNums: seqNums,
future: newFuture[AsyncSocket]("accept")) future: newFuture[AsyncSocket]("accept"))
puncher.attempts.add(attempt) puncher.attempts.add(attempt)
await attempt.addFirewallRules() await attempt.addFirewallRules() # FIXME: needed?
await attempt.injectSynPackets() await attempt.injectSynPackets()
await attempt.future or sleepAsync(Timeout) await attempt.future or sleepAsync(Timeout)
await attempt.deleteFirewallRules() await attempt.deleteFirewallRules() # FIXME: needed?
puncher.attempts.del(puncher.attempts.find(attempt)) puncher.attempts.del(puncher.attempts.find(attempt))
if attempt.future.finished(): if attempt.future.finished():
result = attempt.future.read() result = attempt.future.read()

View File

@ -108,7 +108,7 @@ proc connect*(puncher: TcpSyniConnectPuncher, srcPort: Port, dstIp: IpAddress,
let connectFuture = newFuture[AsyncSocket]("connect") let connectFuture = newFuture[AsyncSocket]("connect")
for dstPort in attempt.dstPorts: for dstPort in attempt.dstPorts:
asyncCheck doConnect(attempt.srcIp, attempt.srcPort, attempt.dstIp, asyncCheck doConnect(attempt.srcIp, attempt.srcPort, attempt.dstIp,
dstPort, connectfuture) dstPort, connectFuture)
await connectFuture or sleepAsync(Timeout) await connectFuture or sleepAsync(Timeout)
await attempt.deleteFirewallRules() await attempt.deleteFirewallRules()
puncher.attempts.del(puncher.attempts.find(attempt)) puncher.attempts.del(puncher.attempts.find(attempt))