nimble/ll: Stop advertising properly after limit occured
We should do full SM stop after duration of max events limit occured to
make sure there is nothing left in scheduler or queues.
@@ -3055,24 +3055,22 @@ ble_ll_adv_done(struct ble_ll_adv_sm *advsm)
}
/* Disable advertising */
- advsm->adv_enabled = 0;
- ble_ll_scan_chk_resume();
+ ble_ll_adv_sm_stop(advsm);
}
return;
}
#else
- if (advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_HD_DIRECTED) {
- if (advsm->adv_pdu_start_time >= advsm->adv_end_time) {
- /* Disable advertising */
- advsm->adv_enabled = 0;
+ if ((advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_HD_DIRECTED) &&
+ (advsm->adv_pdu_start_time >= advsm->adv_end_time)) {
ble_ll_conn_comp_event_send(NULL, BLE_ERR_DIR_ADV_TMO,
advsm->conn_comp_ev, advsm);
advsm->conn_comp_ev = NULL;
- ble_ll_scan_chk_resume();
+
+ /* Disable advertising */
+ ble_ll_adv_sm_stop(advsm);
return;
}
- }
#endif
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
@@ -3087,8 +3085,7 @@ ble_ll_adv_done(struct ble_ll_adv_sm *advsm)
advsm->events);
/* Disable advertising */
- advsm->adv_enabled = 0;
- ble_ll_scan_chk_resume();
+ ble_ll_adv_sm_stop(advsm);
}
return;
@@ -3187,7 +3184,7 @@ ble_ll_adv_sec_done(struct ble_ll_adv_sm *advsm)
}
/* Disable advertising */
- advsm->adv_enabled = 0;
+ ble_ll_adv_sm_stop(advsm);
return;
}
@@ -3196,7 +3193,7 @@ ble_ll_adv_sec_done(struct ble_ll_adv_sm *advsm)
advsm->adv_instance, 0,
advsm->events);
/* Disable advertising */
- advsm->adv_enabled = 0;
+ ble_ll_adv_sm_stop(advsm);
return;
}
