[esp32_ble_client] Reset conn_id on failed OPEN_EVT to prevent stale match

When OPEN_EVT arrives with a failure status, the connection was never
established so no CLOSE_EVT may follow. Reset conn_id_ to prevent a
stale value from matching a future CLOSE_EVT.
This commit is contained in:
J. Nick Koston
2026-02-23 09:32:55 -06:00
parent c75b7de2d3
commit 39c5cffaa1

View File

@@ -311,6 +311,7 @@ bool BLEClientBase::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
if (param->open.status != ESP_GATT_OK && param->open.status != ESP_GATT_ALREADY_OPEN) {
this->log_gattc_warning_("Connection open", param->open.status);
this->set_state(espbt::ClientState::IDLE);
this->conn_id_ = UNSET_CONN_ID;
break;
}
if (this->want_disconnect_) {