try out rate limit

This commit is contained in:
Christian Ulrich 2020-11-18 16:34:33 +01:00
parent 7d31594054
commit abbeaa61d8
No known key found for this signature in database
GPG Key ID: 8241BE099775A097
1 changed files with 1 additions and 0 deletions

View File

@ -63,6 +63,7 @@ proc punch(puncher: Puncher, peerIp: IpAddress, peerPort: Port,
# TODO: replace asyncdispatch.sendTo with asyncnet.sendTo (Nim 1.4 required) # TODO: replace asyncdispatch.sendTo with asyncnet.sendTo (Nim 1.4 required)
await sendTo(puncher.sock.getFd().AsyncFD, msg.cstring, msg.len, await sendTo(puncher.sock.getFd().AsyncFD, msg.cstring, msg.len,
cast[ptr SockAddr](addr peerAddr), peerSockLen) cast[ptr SockAddr](addr peerAddr), peerSockLen)
await sleepAsync(20)
if lowTTL: if lowTTL:
puncher.sock.getFd.setSockOptInt(IPPROTO_IP, IP_TTL, defaultTTL) puncher.sock.getFd.setSockOptInt(IPPROTO_IP, IP_TTL, defaultTTL)
except OSError as e: except OSError as e: