mirror of
https://github.com/esphome/esphome.git
synced 2026-02-27 17:34:22 -07:00
[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:
@@ -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_) {
|
||||
|
||||
Reference in New Issue
Block a user