From 9e18cf91054859160fa15b417f63d88636e9be8b Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Fri, 27 Feb 2026 08:47:57 +0100 Subject: [PATCH] btshell: Fix restarting advertising instances Connection handle needs to be cleared on disconnect. Otherwise with multiple advertising instances active incorrect instance may be matched and attempted to restart (ie if connection handle is reused). --- apps/btshell/src/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/btshell/src/main.c b/apps/btshell/src/main.c index 0db012e98..a0a2fc67a 100644 --- a/apps/btshell/src/main.c +++ b/apps/btshell/src/main.c @@ -1165,9 +1165,9 @@ btshell_restart_adv(struct ble_gap_event *event) #if MYNEWT_VAL(BLE_EXT_ADV) for (i = 0; i < BLE_ADV_INSTANCES; ++i) { - if (ext_adv_restart[i].restart && - (ext_adv_restart[i].conn_handle == - event->disconnect.conn.conn_handle)) { + if (ext_adv_restart[i].restart && (ext_adv_restart[i].conn_handle == + event->disconnect.conn.conn_handle)) { + ext_adv_restart[i].conn_handle = BLE_HS_CONN_HANDLE_NONE; rc = ble_gap_ext_adv_start(i, 0, 0); break; }