fix: actually put the port mapper thread to sleep (#1392)

This commit is contained in:
Giuliano Mega 2026-01-29 10:17:27 -03:00 committed by GitHub
parent 52d27485cd
commit 7c3894da54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -244,15 +244,12 @@ proc repeatPortMapping(args: PortMappingArgs) {.thread, raises: [ValueError].} =
let ipres = getExternalIP(strategy, quiet = true)
if ipres.isSome:
while natClosed.load() == false:
let
# we're being silly here with this channel polling because we can't
# select on Nim channels like on Go ones
currTime = now()
let currTime = now()
if currTime >= (lastUpdate + interval):
discard doPortMapping(strategy, tcpPort, udpPort, description)
lastUpdate = currTime
sleep(sleepDuration)
sleep(sleepDuration)
proc stopNatThreads() {.noconv.} =
# stop the thread