From b4764d3bc369b459bd9227a1e239e9f569e23524 Mon Sep 17 00:00:00 2001 From: grleblanc Date: Mon, 9 Jun 2025 15:05:53 -0400 Subject: [PATCH 1/2] fix(util): update waitForTraceRoute reset logic --- meshtastic/util.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/meshtastic/util.py b/meshtastic/util.py index 38e51d3..760da95 100644 --- a/meshtastic/util.py +++ b/meshtastic/util.py @@ -198,9 +198,9 @@ class Timeout: self.sleepInterval: float = 0.1 self.expireTimeout: int = maxSecs - def reset(self) -> None: + def reset(self, expireTimeout=None): """Restart the waitForSet timer""" - self.expireTime = time.time() + self.expireTimeout + self.expireTime = time.time() + (self.expireTimeout if expireTimeout is None else expireTimeout) def waitForSet(self, target, attrs=()) -> bool: """Block until the specified attributes are set. Returns True if config has been received.""" @@ -225,8 +225,7 @@ class Timeout: def waitForTraceRoute(self, waitFactor, acknowledgment, attr="receivedTraceRoute") -> bool: """Block until traceroute response is received. Returns True if traceroute response has been received.""" - self.expireTimeout *= waitFactor - self.reset() + self.reset(self.expireTimout * waitFactor) while time.time() < self.expireTime: if getattr(acknowledgment, attr, None): acknowledgment.reset() From 04a0ff63226db39591cd1403732f9d890dfd2c8c Mon Sep 17 00:00:00 2001 From: grleblanc Date: Mon, 9 Jun 2025 15:50:21 -0400 Subject: [PATCH 2/2] fix(util): fix typo --- meshtastic/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshtastic/util.py b/meshtastic/util.py index 760da95..3d76e59 100644 --- a/meshtastic/util.py +++ b/meshtastic/util.py @@ -225,7 +225,7 @@ class Timeout: def waitForTraceRoute(self, waitFactor, acknowledgment, attr="receivedTraceRoute") -> bool: """Block until traceroute response is received. Returns True if traceroute response has been received.""" - self.reset(self.expireTimout * waitFactor) + self.reset(self.expireTimeout * waitFactor) while time.time() < self.expireTime: if getattr(acknowledgment, attr, None): acknowledgment.reset()