Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/NimBLEClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,12 @@ int NimBLEClient::handleGapEvent(struct ble_gap_event* event, void* arg) {
} // BLE_GAP_EVENT_MTU

case BLE_GAP_EVENT_PASSKEY_ACTION: {
if (pClient->m_connHandle != event->passkey.conn_handle) {
// The host reports BLE_GAP_EVENT_CONNECT only after reading the peer's features, but
// already runs SMP on the link. A peer that sends a Security Request right after
// connecting can therefore trigger this before m_connHandle is set. This callback is
// registered only for the connection this client is creating, so accept it.
if (pClient->m_connHandle != event->passkey.conn_handle &&
!(pClient->m_connStatus == CONNECTING && pClient->m_connHandle == BLE_HS_CONN_HANDLE_NONE)) {
return 0;
}

Expand Down
Loading