Skip to content

Commit a3b42b7

Browse files
committed
TCP: do not disconnect if ota client is connected
1 parent eddc451 commit a3b42b7

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/ArduinoIoTCloudTCP.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,17 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_ConnectMqttBroker()
319319

320320
ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_Connected()
321321
{
322-
if (!_mqttClient.connected() || !_thing.connected() || !_device.connected())
322+
#if OTA_ENABLED
323+
if(_get_ota_confirmation != nullptr &&
324+
_ota.getState() == OTACloudProcessInterface::State::OtaAvailable &&
325+
_get_ota_confirmation()) {
326+
_ota.approveOta();
327+
}
328+
329+
_ota.update();
330+
#endif // OTA_ENABLED
331+
332+
if ((!_otaClient.connected()) && (!_mqttClient.connected() || !_thing.connected() || !_device.connected()))
323333
{
324334
return State::Disconnect;
325335
}
@@ -338,16 +348,6 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_Connected()
338348
/* Call CloudDevice process to get configuration */
339349
_device.update();
340350

341-
#if OTA_ENABLED
342-
if(_get_ota_confirmation != nullptr &&
343-
_ota.getState() == OTACloudProcessInterface::State::OtaAvailable &&
344-
_get_ota_confirmation()) {
345-
_ota.approveOta();
346-
}
347-
348-
_ota.update();
349-
#endif // OTA_ENABLED
350-
351351

352352
if (_device.isAttached()) {
353353
/* Call CloudThing process to synchronize properties */

0 commit comments

Comments
 (0)