Skip to content

Commit b44cae6

Browse files
fixup! TCP: do not disconnect if ota client is connected
1 parent a3b42b7 commit b44cae6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/ArduinoIoTCloudTCP.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,14 @@ void ArduinoIoTCloudTCP::update()
240240
#if defined (ARDUINO_ARCH_SAMD) || defined (ARDUINO_ARCH_MBED)
241241
watchdog_reset();
242242
#endif
243+
244+
#if OTA_ENABLED
245+
if((_ota.getState() != OTACloudProcessInterface::Resume &&
246+
_ota.getState() != OTACloudProcessInterface::OtaBegin) ||
247+
_mqttClient.connected()) {
248+
_ota.update();
249+
}
250+
#endif // OTA_ENABLED
243251
}
244252

245253
int ArduinoIoTCloudTCP::connected()
@@ -325,8 +333,6 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_Connected()
325333
_get_ota_confirmation()) {
326334
_ota.approveOta();
327335
}
328-
329-
_ota.update();
330336
#endif // OTA_ENABLED
331337

332338
if ((!_otaClient.connected()) && (!_mqttClient.connected() || !_thing.connected() || !_device.connected()))

0 commit comments

Comments
 (0)