Skip to content

Commit 4341014

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 4341014

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

apps/btshell/src/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,8 +1166,8 @@ btshell_restart_adv(struct ble_gap_event *event)
11661166
#if MYNEWT_VAL(BLE_EXT_ADV)
11671167
for (i = 0; i < BLE_ADV_INSTANCES; ++i) {
11681168
if (ext_adv_restart[i].restart &&
1169-
(ext_adv_restart[i].conn_handle ==
1170-
event->disconnect.conn.conn_handle)) {
1169+
(ext_adv_restart[i].conn_handle == 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)