From 7c3894da5490396f71925bedd338b150d8896713 Mon Sep 17 00:00:00 2001 From: Giuliano Mega Date: Thu, 29 Jan 2026 10:17:27 -0300 Subject: [PATCH] fix: actually put the port mapper thread to sleep (#1392) --- codex/nat.nim | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/codex/nat.nim b/codex/nat.nim index 2038ca3d..f3919437 100644 --- a/codex/nat.nim +++ b/codex/nat.nim @@ -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