From 68a357e66dd3706d49de07a9e8a3e6830ce4e511 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Mon, 21 Sep 2020 20:52:07 +0200 Subject: [PATCH] Bluetooth: Shell: PA sync terminate callback clears entry The sync terminate callback did not set any entries in the PA sync array to NULL, thus not allowing the shell to reuse them in case that the sync was lost unexpectectly. Signed-off-by: Emil Gydesen --- subsys/bluetooth/shell/bt.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/subsys/bluetooth/shell/bt.c b/subsys/bluetooth/shell/bt.c index bf2a14d8cf8..e40b937025f 100644 --- a/subsys/bluetooth/shell/bt.c +++ b/subsys/bluetooth/shell/bt.c @@ -1399,6 +1399,13 @@ static void per_adv_sync_terminated_cb( { char le_addr[BT_ADDR_LE_STR_LEN]; + for (int i = 0; i < ARRAY_SIZE(per_adv_syncs); i++) { + if (per_adv_syncs[i] == sync) { + per_adv_syncs[i] = NULL; + break; + } + } + bt_addr_le_to_str(info->addr, le_addr, sizeof(le_addr)); shell_print(ctx_shell, "PER_ADV_SYNC[%u]: [DEVICE]: %s sync terminated", bt_le_per_adv_sync_get_index(sync), le_addr);