From 88b2858af4c5e8cb3272e59258af4c29c2d65db6 Mon Sep 17 00:00:00 2001 From: Edd Inglis Date: Tue, 31 Jul 2018 17:01:54 +0100 Subject: [PATCH] An incomplete connect (either abandoned with a disconnect() or just failed of its own accord) would prevent futher connect()'s due to the CONN_IN_PROGRESS_FLAG remaining set. This change clears that flag in the two cases described. --- features/lorawan/LoRaWANStack.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/features/lorawan/LoRaWANStack.cpp b/features/lorawan/LoRaWANStack.cpp index ece5aed9f8..477752a2b7 100644 --- a/features/lorawan/LoRaWANStack.cpp +++ b/features/lorawan/LoRaWANStack.cpp @@ -1080,6 +1080,7 @@ void LoRaWANStack::process_shutdown_state(lorawan_status_t &op_status) _device_current_state = DEVICE_STATE_SHUTDOWN; op_status = LORAWAN_STATUS_DEVICE_OFF; _ctrl_flags &= ~CONNECTED_FLAG; + _ctrl_flags &= ~CONN_IN_PROGRESS_FLAG; send_event_to_application(DISCONNECTED); } @@ -1160,6 +1161,7 @@ void LoRaWANStack::process_joining_state(lorawan_status_t &op_status) bool can_continue = _loramac.continue_joining_process(); if (!can_continue) { + _ctrl_flags &= ~CONN_IN_PROGRESS_FLAG; send_event_to_application(JOIN_FAILURE); _device_current_state = DEVICE_STATE_IDLE; return;