Closed BrianPugh closed 4 years ago
Hi @BrianPugh , if you look at ble_hs_lock()
carefully it calls ble_hs_lock_nested()
internally if BLE host debug (BLE_HS_DEBUG
) flag is not 1, so there should not be any problem, I have verified from my end.
However I do agree that ble_hs_lock
API's description ' Locks the BLE host mutex. Nested locks not allowed' is little misleading.
@BrianPugh, thank you for reporting the issue, there is upstream PR which addresses your concerns,link to PR: PR!567 . I will get this merged as soon as the upstream PR is merged.
upstream was merged!
Closing as this is now merged in esp-nimble as well.
During bonding, the writing portion (
ble_store_write()
) is surrounded by able_hs_lock()
which explicitly doesn't allow nested locks.https://github.com/espressif/esp-nimble/blob/nimble-1.2.0-idf/nimble/host/src/ble_store.c#L54
However, when it's called during bonding here:
https://github.com/espressif/esp-nimble/blob/nimble-1.2.0-idf/nimble/host/src/ble_gatts.c#L1706
It's also surrounded by
ble_hs_lock()
, so this call will always fail. Shouldble_store_write()
invokeble_hs_lock_nested()
instead? Or is something else wrong?