• MQTT: Don't try to publish if connection not established

    From Rob Swindell@1:103/705 to GitLab note in main/sbbs on Saturday, September 07, 2024 14:40:20
    https://gitlab.synchro.net/main/sbbs/-/issues/781#note_5579

    I'm not clear on how this issue could happen. It looks like a race condition between the broker connection attempt in the terminal server thread and another thread (the event thread) attempting to publish (node status, in this case). But the terminal server thread waits until the MQTT broker connection is either successful or not before continuing and should log the result of the broker-connection attempt:
    ```
    lprintf(lputs, LOG_DEBUG, "MQTT broker-connect (%s:%d) successful", cfg->mqtt.broker_addr, cfg->mqtt.broker_port);
    ```
    or:
    ```
    lprintf(lputs, LOG_ERR, "MQTT broker-connect (%s:%d) failure: %d", cfg->mqtt.broker_addr, cfg->mqtt.broker_port, result);
    ```

    Did you have debug-level log output enabled?
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell@1:103/705 to GitLab note in main/sbbs on Saturday, September 07, 2024 14:49:54
    https://gitlab.synchro.net/main/sbbs/-/issues/781#note_5580

    I suspect the broker connection *was* successful and you just didn't have debug-level logging turned on.
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell@1:103/705 to GitLab issue in main/sbbs on Saturday, September 07, 2024 15:31:04
    close https://gitlab.synchro.net/main/sbbs/-/issues/781
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell@1:103/705 to GitLab issue in main/sbbs on Saturday, September 07, 2024 15:32:10
    reopen https://gitlab.synchro.net/main/sbbs/-/issues/781

    Setting up a new system and when sbbs tried to connect to the mqtt service, it reported:

    Client <unknown> disconnected due to protocol error.

    sbbs reports:
    9/3 13:29:02 term MQTT connecting to broker 127.0.0.1:1883

    but doesn't say it cannot connect, then proceeds with:

    9/3 13:29:02 term Terminal Server ERROR 4 (2) publishing node status
    9/3 13:29:02 evnt DAILY ERROR 4 (2) publishing node status

    MQTT should probably not try to publish when it's not connected.
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell@1:103/705 to GitLab note in main/sbbs on Tuesday, November 05, 2024 23:42:15
    https://gitlab.synchro.net/main/sbbs/-/issues/781#note_5903

    This issue should be resolved now.
    --- SBBSecho 3.21-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)