cosmetic changes; add FIXMEs
This commit is contained in:
parent
38c935a573
commit
9fac0cec0e
|
@ -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()
|
||||||
|
|
|
@ -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))
|
||||||
|
|
Loading…
Reference in New Issue