mirror of https://github.com/arendst/Tasmota.git
Fix possible MQTT disconnect exception
This commit is contained in:
parent
f9fd813842
commit
0e6a012499
|
@ -465,7 +465,9 @@ bool MqttIsConnected(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MqttDisconnect(void) {
|
void MqttDisconnect(void) {
|
||||||
MqttClient.disconnect();
|
if (MqttClient.connected()) {
|
||||||
|
MqttClient.disconnect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MqttSubscribeLib(const char *topic) {
|
void MqttSubscribeLib(const char *topic) {
|
||||||
|
@ -1060,8 +1062,7 @@ void MqttReconnect(void) {
|
||||||
|
|
||||||
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT D_ATTEMPTING_CONNECTION));
|
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT D_ATTEMPTING_CONNECTION));
|
||||||
|
|
||||||
if (MqttClient.connected()) { MqttClient.disconnect(); }
|
MqttDisconnect();
|
||||||
|
|
||||||
MqttSetClientTimeout();
|
MqttSetClientTimeout();
|
||||||
|
|
||||||
MqttClient.setCallback(MqttDataHandler);
|
MqttClient.setCallback(MqttDataHandler);
|
||||||
|
|
Loading…
Reference in New Issue