Skip to content

Commit c2639d7

Browse files
committed
Find client by handle during disconnect event.
If the peer has RPA enabled, searching by address fails due to address resolution. If this occurs, attempt to find the client by connection handle.
1 parent 6f0b9dd commit c2639d7

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/NimBLEClient.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,11 @@ int NimBLEClient::handleGapEvent(struct ble_gap_event* event, void* arg) {
940940
pClient = NimBLEDevice::getClientByPeerAddress(event->disconnect.conn.peer_id_addr);
941941
}
942942

943+
// try by connection handle
944+
if (pClient == nullptr) {
945+
pClient = NimBLEDevice::getClientByHandle(event->disconnect.conn.conn_handle);
946+
}
947+
943948
if (pClient == nullptr) {
944949
NIMBLE_LOGE(LOG_TAG, "Disconnected client not found, conn_handle=%d",
945950
event->disconnect.conn.conn_handle);

0 commit comments

Comments
 (0)