From dbc42420fede7363caa74e5870bf696a133da1ac Mon Sep 17 00:00:00 2001 From: Andrea Gilardoni Date: Tue, 16 Jul 2024 15:34:26 +0200 Subject: [PATCH] moving mqtt poll into ArduinoIoTCloudTCP::handle_Connected --- src/ArduinoIoTCloudTCP.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/ArduinoIoTCloudTCP.cpp b/src/ArduinoIoTCloudTCP.cpp index f2a1b6fc..fe5a5b01 100644 --- a/src/ArduinoIoTCloudTCP.cpp +++ b/src/ArduinoIoTCloudTCP.cpp @@ -232,10 +232,6 @@ void ArduinoIoTCloudTCP::update() #if defined (ARDUINO_ARCH_SAMD) || defined (ARDUINO_ARCH_MBED) watchdog_reset(); #endif - - /* Check for new data from the MQTT client. */ - if (_mqttClient.connected()) - _mqttClient.poll(); } int ArduinoIoTCloudTCP::connected() @@ -307,6 +303,9 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_Connected() return State::Disconnect; } + /* Check for new data from the MQTT client. */ + _mqttClient.poll(); + /* Retransmit data in case there was a lost transaction due * to phy layer or MQTT connectivity loss. */