Skip to content

Commit d69a8e8

Browse files
committed
Fix race condition, connect->disconnect->discovery
1 parent 00a3f84 commit d69a8e8

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/components/ble/NimbleController.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,9 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) {
250250
}
251251

252252
void NimbleController::StartDiscovery() {
253-
serviceDiscovery.StartDiscovery(connectionHandle);
253+
if (connectionHandle != BLE_HS_CONN_HANDLE_NONE) {
254+
serviceDiscovery.StartDiscovery(connectionHandle);
255+
}
254256
}
255257

256258
uint16_t NimbleController::connHandle() {

0 commit comments

Comments
 (0)