Skip to content

Commit e1303f8

Browse files
committed
move mux to BLEDevice class
1 parent fe0b931 commit e1303f8

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

libraries/BLE/src/BLEDevice.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ void BLEDevice::addPeerDevice(void* peer, bool _client, uint16_t conn_id) {
631631

632632
//there may have some situation that invoking this function simultaneously, that will cause CORRUPT HEAP
633633
//let this function serializable
634-
portMUX_TYPE mux = portMUX_INITIALIZER_UNLOCKED;
634+
portMUX_TYPE BLEDevice::mux = portMUX_INITIALIZER_UNLOCKED;
635635
void BLEDevice::removePeerDevice(uint16_t conn_id, bool _client) {
636636
portENTER_CRITICAL(&mux);
637637
log_i("remove: %d, GATT role %s", conn_id, _client?"client":"server");

libraries/BLE/src/BLEDevice.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class BLEDevice {
7373
static BLEAdvertising* m_bleAdvertising;
7474
static esp_gatt_if_t getGattcIF();
7575
static std::map<uint16_t, conn_status_t> m_connectedClientsMap;
76+
static portMUX_TYPE mux;
7677

7778
static void gattClientEventHandler(
7879
esp_gattc_cb_event_t event,

0 commit comments

Comments
 (0)