Restore the reconnect-during-teardown cancel fast path

The collapse of the CONNECTING branch dropped a real race fix: HA
re-requesting a connect while a scheduled teardown was still pending
used to cancel the teardown and let the in-flight open complete;
without it the request was ignored and HA paid a teardown plus a fresh
connect during exactly the reconnect churn this path sees most.

cancel_gatt_disconnect() joins the contract: true only for a scheduled
teardown that has not started closing (Bluedroid clears the latched
want_disconnect_); rp2 and the stubs return false since their teardowns
start inside gatt_disconnect(). The wrapper's cancel_teardown() returns
its state to CONNECTING and the proxy handler carries the dev branch
verbatim.
This commit is contained in:
J. Nick Koston
2026-08-09 15:54:56 -05:00
parent 8696255ccc
commit 3728669fa6
8 changed files with 35 additions and 0 deletions
@@ -31,6 +31,7 @@ class MinimalConnection {
this->listener_->on_connection_state(true, 517, 0);
return 0;
}
bool cancel_gatt_disconnect() { return false; }
int gatt_disconnect() { return 0; }
int discover_services() {
this->listener_->on_service_discovery_done(0);