mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-06-28 13:29:28 +00:00
Add debug logs
This commit is contained in:
parent
6a99e218d7
commit
67155fa2a9
@ -139,6 +139,8 @@ method handleNatStatus*(
|
||||
if autoRelayService.isRunning:
|
||||
if not await autoRelayService.stop(switch):
|
||||
debug "AutoRelayService stop method returned false"
|
||||
else:
|
||||
debug "AutoRelayService stopped"
|
||||
|
||||
discovery.updateRecords(@[dialBackAddr.get], discoveryPort)
|
||||
# TODO: switch DHT to server mode
|
||||
@ -148,10 +150,15 @@ method handleNatStatus*(
|
||||
if dialBackAddr.isNone:
|
||||
warn "Got empty dialback address in AutoNat when node is NotReachable"
|
||||
else:
|
||||
debug "Node is not reachable trying UPnP / PMP now"
|
||||
|
||||
let maybePorts = await m.mapNatPorts()
|
||||
|
||||
if maybePorts.isSome:
|
||||
let (tcpPort, udpPort) = maybePorts.get()
|
||||
|
||||
info "Port mapping created successfully", tcpPort, udpPort
|
||||
|
||||
let announceAddress = dialBackAddr.get.remapAddr(port = some(tcpPort))
|
||||
|
||||
# TODO: Try a dial me to make sure we are reachable
|
||||
@ -159,13 +166,19 @@ method handleNatStatus*(
|
||||
if autoRelayService.isRunning:
|
||||
if not await autoRelayService.stop(switch):
|
||||
debug "AutoRelayService stop method returned false"
|
||||
else:
|
||||
debug "AutoRelayService stopped"
|
||||
|
||||
discovery.updateRecords(@[announceAddress], udpPort)
|
||||
hasPortMapping = true
|
||||
|
||||
if not hasPortMapping and not autoRelayService.isRunning:
|
||||
debug "No port mapping found let's start autorelay"
|
||||
|
||||
if not await autoRelayService.setup(switch):
|
||||
debug "AutoRelayService setup method returned false"
|
||||
warn "Cannot start autorelay service"
|
||||
else:
|
||||
debug "AutoRelayService started"
|
||||
|
||||
proc close*(m: NatMapper, device = UpnpDevice()) =
|
||||
# UPnP mappings are permanent (leaseDuration=0) and must be deleted explicitly.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user