This is an automated email from the ASF dual-hosted git repository.

janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git


The following commit(s) were added to refs/heads/master by this push:
     new 9e18cf910 btshell: Fix restarting advertising instances
9e18cf910 is described below

commit 9e18cf91054859160fa15b417f63d88636e9be8b
Author: Szymon Janc <[email protected]>
AuthorDate: Fri Feb 27 08:47:57 2026 +0100

    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;
         }

Reply via email to