Files
meshcore_py/src
Matthew Wolter ab4c27dcae G3: F03 — restructure _attempt_reconnect from tail-recursion to loop
_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
2026-04-11 19:47:12 -07:00
..