Skip to content
Snippets Groups Projects
Commit ca2a7636 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Don't try to MQTT publish node output/status if the broker-connect failed

Fixes issue #679
parent 31ec5431
No related branches found
No related tags found
No related merge requests found
......@@ -2544,7 +2544,7 @@ void output_thread(void* arg)
RingBufWrite(startup->node_spybuf[sbbs->cfg.node_num-1],buf+bufbot,i);
}
/* Spy on the user remotely */
if(sbbs->cfg.mqtt.enabled) {
if(sbbs->cfg.mqtt.enabled && mqtt.handle != NULL) {
int result = mqtt_pub_message(&mqtt, TOPIC_BBS, spy_topic, buf+bufbot, i, /* retain: */false);
if(result != MQTT_SUCCESS)
lprintf(LOG_WARNING, "%s ERROR %d (%d) publishing node output (%u bytes): %s"
......
......@@ -91,7 +91,7 @@ int sbbs_t::putnodedat(uint number, node_t* node)
}
pthread_mutex_unlock(&nodefile_mutex);
if(cfg.mqtt.enabled) {
if(cfg.mqtt.enabled && mqtt->handle != NULL) {
snprintf(str, sizeof(str), "%u\t%u\t%u\t%u\t%x\t%u\t%u\t%u"
,node->status
,node->action
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment