Guarding PhoneAPI node-info staging with mutex to prevent BLE future foot-gun (#8354)

* Eliminating foot-gun and placing Phone NodeInfo into a mutex

* Swapping over to concurrency::Lock from mutex
This commit is contained in:
Clive Blackledge
2025-10-15 04:08:06 -07:00
committed by GitHub
parent 034d2dd025
commit a6df18e60a
3 changed files with 72 additions and 36 deletions

View File

@@ -139,7 +139,7 @@ class NimbleBluetoothFromRadioCallback : public NimBLECharacteristicCallbacks
{
bluetoothPhoneAPI->phoneWants = true;
bluetoothPhoneAPI->setIntervalFromNow(0);
std::lock_guard<std::mutex> guard(bluetoothPhoneAPI->nimble_mutex);
std::lock_guard<std::mutex> guard(bluetoothPhoneAPI->nimble_mutex); // BLE callbacks run in NimBLE task
if (!bluetoothPhoneAPI->hasChecked) {
// Fetch payload on demand; prefetch keeps this fast for the first read.