=reconnect a previous established MQTT-connection
This commit is contained in:
@@ -588,6 +588,9 @@ void MqttHandler::handleTraffic() {
|
|||||||
#else
|
#else
|
||||||
ret = mosquitto_loop(m_mosquitto, -1);
|
ret = mosquitto_loop(m_mosquitto, -1);
|
||||||
#endif
|
#endif
|
||||||
|
if(ret == MOSQ_ERR_NO_CONN) {
|
||||||
|
ret = mosquitto_reconnect(m_mosquitto);
|
||||||
|
}
|
||||||
if (!m_connected && ret == MOSQ_ERR_SUCCESS) {
|
if (!m_connected && ret == MOSQ_ERR_SUCCESS) {
|
||||||
m_connected = true;
|
m_connected = true;
|
||||||
logOtherNotice("mqtt", "connection re-established");
|
logOtherNotice("mqtt", "connection re-established");
|
||||||
|
|||||||
Reference in New Issue
Block a user