MQTT gateway for ESP8266 or ESP32 with bidirectional 433mhz/315mhz/868mhz, Infrared communications, BLE, Bluetooth, beacons detection, mi flora, mi jia, LYWSD02, LYWSD03MMC, Mi Scale, TPMS, BBQ thermometer compatibility & LoRa.
Protecting mqtt->publish() fixed the problem with corruption of MQTT discovery config messages https://github.com/1technophile/OpenMQTTGateway/issues/2012
Protecting mqtt->loop() seems like good practice since that could potentially conflict with another thread running mqtt->publish
Note I left mqtt->connect unprotected since I think that is unlikely to lead to data corruption or race conditions.
Similarly, I left mqtt->begin, mqtt->disconnect, mqtt->stop, mqtt->subscribe and mqtt->will unprotected since they occur either during setup or just prior to esp restart so I think again corruption and race conditions are unlikely.
Checklist:
[x ] The pull request is done against the latest development branch
[x] Only one feature/fix was added per PR and the code change compiles without warnings
Description:
Protecting
mqtt->publish()
fixed the problem with corruption of MQTT discovery config messages https://github.com/1technophile/OpenMQTTGateway/issues/2012 Protectingmqtt->loop()
seems like good practice since that could potentially conflict with another thread runningmqtt->publish
Note I left
mqtt->connect
unprotected since I think that is unlikely to lead to data corruption or race conditions. Similarly, I leftmqtt->begin
,mqtt->disconnect
,mqtt->stop
,mqtt->subscribe
andmqtt->will
unprotected since they occur either during setup or just prior to esp restart so I think again corruption and race conditions are unlikely.Checklist: