Skip to content

Commit 9e18cf9

Browse files
committed
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).
1 parent c1d52a2 commit 9e18cf9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

apps/btshell/src/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,9 +1165,9 @@ btshell_restart_adv(struct ble_gap_event *event)
11651165

11661166
#if MYNEWT_VAL(BLE_EXT_ADV)
11671167
for (i = 0; i < BLE_ADV_INSTANCES; ++i) {
1168-
if (ext_adv_restart[i].restart &&
1169-
(ext_adv_restart[i].conn_handle ==
1170-
event->disconnect.conn.conn_handle)) {
1168+
if (ext_adv_restart[i].restart && (ext_adv_restart[i].conn_handle ==
1169+
event->disconnect.conn.conn_handle)) {
1170+
ext_adv_restart[i].conn_handle = BLE_HS_CONN_HANDLE_NONE;
11711171
rc = ble_gap_ext_adv_start(i, 0, 0);
11721172
break;
11731173
}

0 commit comments

Comments
 (0)