h2zero / esp-nimble-cpp

C++ library for the esp32 NimBLE stack based on and mostly compatible with @nkolban cpp_utils BLE library.
https://h2zero.github.io/esp-nimble-cpp/
Apache License 2.0
181 stars 62 forks source link

Fix task blocking #224

Closed h2zero closed 1 week ago

h2zero commented 2 weeks ago

Instead of incrementing the notificatin value via xTaskNotifyGive this will now set a specific bit in the task notification value which will be tested before blocking a task. This will prevent a task from blocking indefinitely if the event that calls taskRelease occurs before entering the blocked state.

Refactor NimBLEClient::connect and NimBLEClient::secureConnection.

This change ensures that only the function that sets m_pTaskData clears it, potentially preventing a segmentation fault.

Fixes #222