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