include srcPorts in the debug message

master
Christian Ulrich 2020-11-20 22:15:53 +01:00
parent 6e331e9631
commit e47a9d0191
No known key found for this signature in database
GPG Key ID: 8241BE099775A097
1 changed files with 1 additions and 2 deletions

View File

@ -64,7 +64,7 @@ proc punch(puncher: Puncher, peerIp: IpAddress, peerPort: Port,
raise newException(PunchHoleError, raise newException(PunchHoleError,
"hole punching for given parameters already active") "hole punching for given parameters already active")
puncher.attempts.add(result) puncher.attempts.add(result)
echo &"sending msg {msg} to {peerIp}, predicted ports: {result.dstPorts}" echo &"sending msg {msg} to {peerIp}, srcPorts: {result.srcPorts}, dstPorts: {result.dstPorts}"
var peerAddr: Sockaddr_storage var peerAddr: Sockaddr_storage
var peerSockLen: SockLen var peerSockLen: SockLen
try: try:
@ -74,7 +74,6 @@ proc punch(puncher: Puncher, peerIp: IpAddress, peerPort: Port,
if lowTTL: if lowTTL:
defaultTTL = sock.getFd.getSockOptInt(IPPROTO_IP, IP_TTL) defaultTTL = sock.getFd.getSockOptInt(IPPROTO_IP, IP_TTL)
sock.getFd.setSockOptInt(IPPROTO_IP, IP_TTL, 2) sock.getFd.setSockOptInt(IPPROTO_IP, IP_TTL, 2)
for dstPort in result.dstPorts: for dstPort in result.dstPorts:
toSockAddr(result.dstIp, dstPort, peerAddr, peerSockLen) toSockAddr(result.dstIp, dstPort, peerAddr, peerSockLen)
# TODO: replace asyncdispatch.sendTo with asyncnet.sendTo (Nim 1.4 required) # TODO: replace asyncdispatch.sendTo with asyncnet.sendTo (Nim 1.4 required)