Skip to content

Commit 605288f

Browse files
committed
MCU8MASS-1943 Don't send AT commands for MQTT disconnect if the modem is not connected to the network
1 parent 6ca5f43 commit 605288f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/mqtt_client.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -541,14 +541,14 @@ bool MqttClientClass::end(void) {
541541
SequansController.unregisterCallback(MQTT_ON_CONNECT_URC);
542542
SequansController.unregisterCallback(MQTT_ON_DISCONNECT_URC);
543543

544-
if (isConnected()) {
544+
if (Lte.isConnected() && isConnected()) {
545545

546546
SequansController.writeCommand(MQTT_DISCONNECT);
547547
SequansController.clearReceiveBuffer();
548-
549-
connected_to_broker = false;
550548
}
551549

550+
connected_to_broker = false;
551+
552552
if (disconnected_callback != NULL) {
553553
disconnected_callback();
554554
}

0 commit comments

Comments
 (0)