mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-09-30 03:01:21 +02:00
Round 1 (b6636053+4ffefa60) shipped the keepalive parser, 1.5x idle disconnect per MQTT spec section 4.4, and a per-minute status-push diagnostic. Reporter's follow-up pcap showed the round-1 logic was correct as designed, but the actual root cause sits one layer down: the same OrcaSlicer install that stays connected to a real Bambu P1S indefinitely sends zero MQTT packets after the initial CONNECT / SUBSCRIBE / pushall / get_version burst - no PINGREQ at all - so any spec-compliant server disconnects it at keep_alive x 1.5. Real Bambu firmware does not enforce section 4.4. The reporter's identical Orca install holds idle sessions against real hardware on the same network. Spec compliance was itself the regression. Fix: after CONNECT/auth, drop the application-level read timeout entirely (read_timeout = None) and set SO_KEEPALIVE on the underlying socket so the OS TCP stack reaps dead connections within a few minutes. The 60s pre-CONNECT cap is preserved - a client that opens TCP but never sends CONNECT still gets reaped. Negotiated keepalive is still parsed and now logged at INFO ("MQTT client X authenticated (negotiated keepalive=Ys, idle disconnect disabled)") for support- bundle visibility. After this ships, OrcaSlicer should stay connected to the VP indefinitely while idle and reconnect cleanly on real network drops. The publish_json code -4 and -6010 errors reported in the original thread were downstream of this disconnect and should also clear.