Skip to content

Commit 5197916

Browse files
authored
Fix BLEClient disconnect bug (#3876)
By default the disconnect is broadcasted to every clients. So if you call disconnect on one connected client, they'll all be disconnected if we don't filter the event by conn_id.
1 parent 7e9d42d commit 5197916

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Diff for: libraries/BLE/src/BLEClient.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ void BLEClient::gattClientEventHandler(
178178
// - uint16_t conn_id
179179
// - esp_bd_addr_t remote_bda
180180
case ESP_GATTC_DISCONNECT_EVT: {
181+
if (evtParam->disconnect.conn_id != m_conn_id)
182+
break;
181183
// If we receive a disconnect event, set the class flag that indicates that we are
182184
// no longer connected.
183185
m_isConnected = false;

0 commit comments

Comments
 (0)