mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-06-11 11:56:18 +00:00
ConnectionManager._attempt_reconnect called self.connection.connect() directly, bypassing MeshCore.connect() which runs send_appstart(). Firmware requires CMD_APP_START after every transport-level connection to initialize the session. Without it, the reconnected transport has no active session — sends go unanswered, tcp_no_response fires after 5 attempts, handle_disconnect re-enters _attempt_reconnect, and the reconnect storm begins. Fix: add an optional reconnect_callback parameter to ConnectionManager.__init__. MeshCore passes self._on_reconnect which calls send_appstart() after the transport reconnects. The callback is invoked inside _attempt_reconnect immediately after a successful connect(), before the CONNECTED event is emitted. Callback failures are logged as warnings but do not break the reconnect — the transport is up regardless. Default None keeps the API backwards-compatible for direct ConnectionManager users. Refs: Forensics report finding F02