• src/sbbs3/mqtt_broker.cpp mqtt_broker.h

    From Deuc¿@VERT to Git commit to main/sbbs/master on Saturday, May 09, 2026 22:50:36
    https://gitlab.synchro.net/main/sbbs/-/commit/7372b198cc5347a0cade1ae7
    Modified Files:
    src/sbbs3/mqtt_broker.cpp mqtt_broker.h
    Log Message:
    mqtt: split into accept/broker threads, flush from caller, poll/select

    Accept thread handles blocking TLS handshakes. Broker thread uses
    poll() (PREFER_POLL) or select() for network session I/O with 1s
    timeout. local_publish and publish_sys flush network send buffers
    directly in the calling thread, eliminating delivery latency for local-to-network message routing. Thread names set via SetThreadName.

    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Deuc¿@VERT to Git commit to main/sbbs/master on Sunday, May 10, 2026 19:29:42
    https://gitlab.synchro.net/main/sbbs/-/commit/7c52f1a90e33431d5824fc46
    Modified Files:
    src/sbbs3/mqtt_broker.cpp mqtt_broker.h
    Log Message:
    mqtt_broker: fix session map key collision on socket descriptor reuse

    Sessions were keyed by "pending-{socket}" strings. When a client
    disconnected, the session stayed in the map with socket=-1. When
    the OS reused the socket descriptor for a new connection, the old
    dead session was silently overwritten, corrupting broker state and
    causing subsequent connections to fail.

    Fix: key sessions by SOCKET descriptor directly. Dead sessions are
    erased before creating new entries for the same descriptor. Cleanup (unsubscribe, will delivery) now happens before socket close to
    ensure the descriptor isn't reused while cleanup is in progress.

    Also: use INVALID_SOCKET consistently instead of -1 for invalid
    socket descriptors (portability).

    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net