Tags: SukramJ/go-zendure2mqtt
Tags
fix(mqtt): detect half-open connections via PINGRESP watchdog (0.1.4) (… …#15) * fix(mqtt): detect half-open connection via PINGRESP watchdog keepAliveLoop sent PINGREQ but never verified the matching PINGRESP, and readLoop runs without a read deadline. On a half-open socket (broker or network gone without a TCP FIN/RST) readLoop blocks in ReadFrame forever, handleConnectionLost never fires, and the lifecycle never reconnects — publishes then time out with "context deadline exceeded" on a dead socket until a manual restart. Track an outstanding PINGREQ with a pingOutstanding flag: keepAliveLoop arms it after writing the PINGREQ, readLoop clears it on PINGRESP. If a tick finds it still set, declare the connection lost so the lifecycle re-dials. The watchdog window is an internal pingInterval field (default KeepAlive/2) so tests can shrink it below the 30s KeepAlive floor. Adds TestMQTTReconnectAfterPingTimeout with a DropPings mock broker. * chore(release): 0.1.4 Bump version and changelog for the MQTT PINGRESP watchdog fix.
PreviousNext