mirror of
https://github.com/efiten/coredrive-rx.git
synced 2026-11-24 05:18:00 +00:00
Publisher.reconnect() called mqtt.js client.reconnect() unconditionally. mqtt.js connect() replaces this.stream without closing the previous one (client.js:257), so a press while a CONNECT was still unanswered left the earlier socket open. When an orphan closed, its 'close' set client.connected = false over a live session and armed a reconnect that orphaned that session in turn. Field log 2026-09-19: connack timeouts on a weak mobile link, then five presses in four seconds (12:05:54 to 12:05:57), then "connected" followed by "offline" and "connection closed" in the same second at 12:05:58, 12:06:00, 12:06:02 and 12:06:04. reconnect() now returns false and does nothing while an attempt is in flight (no session, no reconnect timer armed); the Push button logs that. Once the socket has closed it still skips the 4 s wait. Two tests run the real mqtt.js client over a fake stream; without the guard the first fails. Not verified: the EMQX log has no lines for this client id, so the broker-side session takeover between the sockets was not observed. Version, release notes and the service-worker cache bump ride along, as AGENTS.md requires. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>