nimble/ll: Drop event if adv ext is delayed beyond aux
Sometimes if things are delayed we may try to send adv ext after
scheduled aux - in this case just drop entire event as it won't make
much sense for receiver anyway.
This can easily happen when connecting debugger to running platform.
@@ -2782,6 +2782,16 @@ ble_ll_adv_done(struct ble_ll_adv_sm *advsm)
*/
advsm->adv_pdu_start_time = os_cputime_get32() +
g_ble_ll_sched_offset_ticks;
+
+#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
+ /* If we're past aux (unlikely, but can happen), just drop an event */
+ if (!(advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_LEGACY) &&
+ (advsm->adv_pdu_start_time > advsm->adv_secondary_start_time)) {
+ ble_ll_adv_drop_event(advsm);
+ return;
+ }
+#endif
+
resched_pdu = 1;
}
