mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-09-16 22:19:54 +00:00
BLE Host - Delay sync callback after IRK restore
-Prior to commit- On startup, the host executes the following steps: 1. HCI startup sequence 2. Call sync callback 3. Restore IRKs from flash The problem is that step 3 (IRK restoration) causes a GAP preemption if there are any persisted IRKs. If the application initiates a GAP procedure during the sync callback, it will be immediately preempted. This happens in the bleprph app, for example. -After commit- Don't call the sync callback until after IRK restoration is complete. X-Original-Commit: 28f4a0d78df247d25542801ed79c3f6d9aed4983
This commit is contained in:
@@ -306,9 +306,6 @@ ble_hs_sync(void)
|
||||
rc = ble_hs_startup_go();
|
||||
if (rc == 0) {
|
||||
ble_hs_sync_state = BLE_HS_SYNC_STATE_GOOD;
|
||||
if (ble_hs_cfg.sync_cb != NULL) {
|
||||
ble_hs_cfg.sync_cb();
|
||||
}
|
||||
} else {
|
||||
ble_hs_sync_state = BLE_HS_SYNC_STATE_BAD;
|
||||
}
|
||||
@@ -316,6 +313,13 @@ ble_hs_sync(void)
|
||||
ble_hs_timer_sched(BLE_HS_SYNC_RETRY_RATE);
|
||||
|
||||
if (rc == 0) {
|
||||
rc = ble_hs_misc_restore_irks();
|
||||
assert(rc == 0);
|
||||
|
||||
if (ble_hs_cfg.sync_cb != NULL) {
|
||||
ble_hs_cfg.sync_cb();
|
||||
}
|
||||
|
||||
STATS_INC(ble_hs_stats, sync);
|
||||
}
|
||||
|
||||
@@ -556,9 +560,6 @@ ble_hs_start(void)
|
||||
|
||||
ble_hs_sync();
|
||||
|
||||
rc = ble_hs_misc_restore_irks();
|
||||
assert(rc == 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user