Don't attempt to publish MQTT messages unless/until connected to broker
For cases where an mqtt struct is shared between threads without concurrency control. I'm making this improvement in light of research into issue #781, though I don't expect this change to fix the reported issue. The reported error seems to come from the event thread (publishing node status upon starting to run the "DAILY" event) when a broker connection was not successful, however the reporter (Nelgin) may not have had debug-level logging turned on, so didn't capture the successful broker-connect log message. I think the broker connection *was* successful and perhaps then terminated by the broker ("due to protocol error"?).
Showing
- src/sbbs3/con_out.cpp 1 addition, 1 deletionsrc/sbbs3/con_out.cpp
- src/sbbs3/main.cpp 1 addition, 1 deletionsrc/sbbs3/main.cpp
- src/sbbs3/mqtt.c 18 additions, 13 deletionssrc/sbbs3/mqtt.c
- src/sbbs3/mqtt.h 1 addition, 0 deletionssrc/sbbs3/mqtt.h
- src/sbbs3/putnode.cpp 1 addition, 1 deletionsrc/sbbs3/putnode.cpp
Please register or sign in to comment