mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2026-01-28 10:02:19 +01:00
Fix crashing caused by calling time() in a critical section (#159)
* Fix for random notify crash in ISR context Tested for stability over 30 minutes with a daisy chain of 3 esp32 Co-authored-by: h2zero <powellperalta@gmail.com>
This commit is contained in:
@@ -789,9 +789,10 @@ uint16_t NimBLEClient::getMTU() {
|
||||
if(characteristic != cVector->cend()) {
|
||||
NIMBLE_LOGD(LOG_TAG, "Got Notification for characteristic %s", (*characteristic)->toString().c_str());
|
||||
|
||||
time_t t = time(nullptr);
|
||||
portENTER_CRITICAL(&(*characteristic)->m_valMux);
|
||||
(*characteristic)->m_value = std::string((char *)event->notify_rx.om->om_data, event->notify_rx.om->om_len);
|
||||
(*characteristic)->m_timestamp = time(nullptr);
|
||||
(*characteristic)->m_timestamp = t;
|
||||
portEXIT_CRITICAL(&(*characteristic)->m_valMux);
|
||||
|
||||
if ((*characteristic)->m_notifyCallback != nullptr) {
|
||||
|
||||
Reference in New Issue
Block a user