From 5e9cb559e728cef39ad34267445f81ce3948d9a1 Mon Sep 17 00:00:00 2001 From: Alex Wolden Date: Wed, 8 Apr 2026 21:42:21 -0700 Subject: [PATCH] Use firmware suggested_timeout for login and path discovery sync methods Co-Authored-By: Claude Opus 4.6 (1M context) --- src/meshcore/commands/messaging.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/meshcore/commands/messaging.py b/src/meshcore/commands/messaging.py index 25ae0c7..b266ae0 100644 --- a/src/meshcore/commands/messaging.py +++ b/src/meshcore/commands/messaging.py @@ -34,12 +34,14 @@ class MessagingCommands(CommandHandlerBase): logger.warning("*** please consider using send_login_sync instead of send_login") return await self._send_login_raw(dst, pwd) - async def send_login_sync(self, dst: DestinationType, pwd: str, timeout: float = 10.0) -> Optional[Event]: + async def send_login_sync(self, dst: DestinationType, pwd: str, timeout=0, min_timeout=0) -> Optional[Event]: """Send login to a remote node and wait for the response.""" async with self._mesh_request_lock: result = await self._send_login_raw(dst, pwd) if result is None or result.type == EventType.ERROR: return None + timeout = result.payload["suggested_timeout"] / 800 if timeout == 0 else timeout + timeout = timeout if timeout > min_timeout else min_timeout login_event = await self.dispatcher.wait_for_event( EventType.LOGIN_SUCCESS, timeout=timeout, @@ -199,12 +201,14 @@ class MessagingCommands(CommandHandlerBase): logger.warning("*** please consider using send_path_discovery_sync instead of send_path_discovery") return await self._send_path_discovery_raw(dst) - async def send_path_discovery_sync(self, dst: DestinationType, timeout: float = 30.0) -> Optional[Event]: + async def send_path_discovery_sync(self, dst: DestinationType, timeout=0, min_timeout=0) -> Optional[Event]: """Send path discovery request and wait for the response.""" async with self._mesh_request_lock: result = await self._send_path_discovery_raw(dst) if result is None or result.type == EventType.ERROR: return None + timeout = result.payload["suggested_timeout"] / 800 if timeout == 0 else timeout + timeout = timeout if timeout > min_timeout else min_timeout path_event = await self.dispatcher.wait_for_event( EventType.PATH_RESPONSE, timeout=timeout,