Skip to content
This repository was archived by the owner on May 27, 2024. It is now read-only.

Commit 6b69a65

Browse files
MyIgelfooker
authored andcommitted
Fix for MQTT reconnection problems
1 parent e2231cf commit 6b69a65

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

framework/managers/MqttConnectionManager.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,12 @@ void MqttConnectionManager::onDisconnected(TcpClient &client, bool flag) {
6161
LOG.log("Unreachable");
6262
}
6363

64-
this->state.set(State::DISCONNECTED);
65-
this->reconnectTimer.start();
64+
if (this->state == State::CONNECTED) {
65+
this->state.set(State::DISCONNECTED);
66+
this->reconnectTimer.start();
67+
} else {
68+
LOG.log("Error: Ignored disconnect while connecting");
69+
}
6670
}
6771

6872
void MqttConnectionManager::onMessageReceived(const String topic, const String message) {

0 commit comments

Comments
 (0)