• exec/broker.js

    From Deucе@1:103/705 to Git commit to main/sbbs/master on Wed May 6 23:58:20 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/b524c0aa3fea3ee8a720de34
    Modified Files:
    exec/broker.js
    Log Message:
    broker.js: fix PUBLISH payload framing and subscription ID handling

    serializePayload() was wrapping the payload with encodeBinaryData() or encodeUTF8String(), both of which prepend a 2-byte length prefix. MQTT
    PUBLISH payloads are raw — the length is implicit from the fixed header's remaining length field. This caused all forwarded messages to have garbage bytes prepended.

    dupeForSubscriptions() was collecting topic filter strings (the object
    keys from the subscriber map) instead of the subscription_id from
    each Subscription object. Also skip null/zero subscription IDs rather
    than encoding them as property 11 value 0, which violates the MQTT 5.0
    spec (SubscriptionIdentifier must be in the range 1-268435455).

    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to Git commit to main/sbbs/master on Thu May 7 02:03:23 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/a57da0ce23000622e8aec090
    Modified Files:
    exec/broker.js
    Log Message:
    broker.js: fix subscriber registration for existing topics

    The Subscription constructor was writing to
    topics[i][this.client_id] (a dangling property on the Topic object
    with this.client_id being undefined) instead of topics[i].subscribers[conn.client_id]. This meant subscribers were
    never registered in the .subscribers map for topics that already
    existed at subscribe time. Retained messages still worked because
    they were sent directly from the constructor, but live publishes
    never found the subscriber.

    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to Git commit to main/sbbs/master on Thu May 7 11:11:34 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/7b9c37f55f2dffb461610ac2
    Modified Files:
    exec/broker.js
    Log Message:
    broker.js: fix memory leaks from subscription references

    Subscription.remove() used topics[i][this.client_id] instead of topics[i].subscribers[this.conn.client_id] — the same property-path
    bug fixed in the constructor (a8a6bfebe). Subscriptions were never
    actually removed from Topic subscriber maps, keeping Connection
    objects alive through circular references indefinitely.

    Added removeAllSubscriptions() method and call it from:
    - tearDown() when session_expiry is 0 (no session persistence)
    - expireSession() before deleting from broker.disconnected
    - handleCONNECT when clean_start replaces an old connection

    Also clean up empty subscriber entries from topic maps after the
    last subscription for a client is removed.

    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)