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).
This commit is contained in:
Szymon Janc
2026-02-27 11:18:00 +01:00
parent c1d52a2cc8
commit 9e18cf9105
+3 -3
View File
@@ -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;
}