Skip to content

Commit 553ff26

Browse files
Michał Narajowskicarlescufi
authored andcommitted
[nrf fromtree] Bluetooth: host: Fix advertise stop in adv_timeout()
Call bt_le_adv_stop() if adv == bt_dev.adv (Meaning it is the legacy advertiser and was started with bt_le_adv_start()), otherwise use bt_le_ext_adv_stop(), because it was started with bt_le_ext_adv_start(). Failing to stop advertising shouldn't result in assert. Signed-off-by: Michał Narajowski <[email protected]> (cherry picked from commit cca76f1) Signed-off-by: Martin Tverdal <[email protected]>
1 parent b3440b1 commit 553ff26

File tree

1 file changed

+6
-3
lines changed
  • subsys/bluetooth/host

1 file changed

+6
-3
lines changed

subsys/bluetooth/host/adv.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,12 +1367,15 @@ static void adv_timeout(struct k_work *work)
13671367
dwork = k_work_delayable_from_work(work);
13681368
adv = CONTAINER_OF(dwork, struct bt_le_ext_adv, timeout_work);
13691369

1370-
err = bt_le_ext_adv_stop(adv);
1370+
if (adv == bt_dev.adv) {
1371+
err = bt_le_adv_stop();
1372+
} else {
1373+
err = bt_le_ext_adv_stop(adv);
1374+
}
13711375
#else
13721376
err = bt_le_adv_stop();
13731377
#endif
1374-
__ASSERT(err == 0, "Limited Advertising timeout reached, "
1375-
"failed to stop advertising");
1378+
BT_WARN("Failed to stop advertising: %d", err);
13761379
}
13771380

13781381
#if defined(CONFIG_BT_PER_ADV)

0 commit comments

Comments
 (0)