mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-07-27 18:38:13 +00:00
_attempt_reconnect previously tail-recursed via asyncio.create_task, re-assigning self._reconnect_task from inside the running coroutine. This orphaned the current task — disconnect() cancelled only the newest pointer, leaving previous-generation attempts in flight. Those orphaned tasks could set _is_connected = True after the caller thought the session was closed. Fix: replace with a single iterative while loop that holds one persistent task for the entire reconnect session. The task is created once in handle_disconnect and torn down only on success, max attempts exhausted, or disconnect() cancellation. Refs: Forensics report finding F03