Skip to content

Commit

Permalink
Fix BLEClient disconnect bug (#3876)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sindney authored Sep 30, 2020
1 parent 7e9d42d commit 5197916
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libraries/BLE/src/BLEClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ void BLEClient::gattClientEventHandler(
// - uint16_t conn_id
// - esp_bd_addr_t remote_bda
case ESP_GATTC_DISCONNECT_EVT: {
if (evtParam->disconnect.conn_id != m_conn_id)
break;
// If we receive a disconnect event, set the class flag that indicates that we are
// no longer connected.
m_isConnected = false;
Expand Down

0 comments on commit 5197916

Please sign in to comment.