mirror of
https://github.com/esphome/esphome.git
synced 2026-02-27 17:34:22 -07:00
[esp32_ble_client] Don't reset conn_id_ in want_disconnect_ path
The CLOSE_EVT handler matches on conn_id_ to call set_idle_(). Resetting conn_id_ to UNSET_CONN_ID before CLOSE_EVT arrives causes the event to be dropped, leaving the client stuck in DISCONNECTING state permanently. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -318,8 +318,8 @@ bool BLEClientBase::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
||||
// Disconnect was requested after connecting started,
|
||||
// but before the connection was established. Now that we have
|
||||
// this->conn_id_ set, we can disconnect it.
|
||||
// Don't reset conn_id_ here — CLOSE_EVT needs it to match and call set_idle_().
|
||||
this->unconditional_disconnect();
|
||||
this->conn_id_ = UNSET_CONN_ID;
|
||||
break;
|
||||
}
|
||||
// MTU negotiation already started in ESP_GATTC_CONNECT_EVT
|
||||
|
||||
Reference in New Issue
Block a user