mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-07-27 19:57:38 +00:00
[Network] Improve response time on network disconnect for MQTT client
This commit is contained in:
@@ -408,7 +408,7 @@ void processMQTTdelayQueue() {
|
||||
}
|
||||
|
||||
void updateMQTTclient_connected() {
|
||||
const bool actual_MQTTclient_connected = ESPEasy::net::NetworkConnected() && MQTTclient.connected();
|
||||
const bool actual_MQTTclient_connected = ESPEasy::net::NetworkConnected(true) && MQTTclient.connected();
|
||||
if (MQTTclient_connected != actual_MQTTclient_connected) {
|
||||
MQTTclient_connected = actual_MQTTclient_connected;
|
||||
if (!actual_MQTTclient_connected) mqtt.stop(); // Make sure PubSubClient isn't trying to do a graceful disconnect
|
||||
@@ -456,7 +456,7 @@ void updateMQTTclient_connected() {
|
||||
void runPeriodicalMQTT() {
|
||||
START_TIMER
|
||||
// MQTT_KEEPALIVE = 15 seconds.
|
||||
if (!NetworkConnected(10)) {
|
||||
if (!ESPEasy::net::NetworkConnected()) {
|
||||
updateMQTTclient_connected();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user