Remove timer when connection is cancelled
Bug: 237600252
Test: gd/cert/run, testplans/1181383
Tag: #refactor
BYPASS_LONG_LINES_REASON: Bluetooth likes 120 lines
Ignore-AOSP-First: Cherry-pick
Merged-In: I3b8dccb23259d9b97cd248dc8adf7423f74ad3a1
Change-Id: I3b8dccb23259d9b97cd248dc8adf7423f74ad3a1
(cherry picked from commit 97412bc399f30bac11dd469e1ecdb3ca000979e3)
Merged-In: I3b8dccb23259d9b97cd248dc8adf7423f74ad3a1
diff --git a/system/gd/hci/acl_manager/le_impl.h b/system/gd/hci/acl_manager/le_impl.h
index dbef2f2..b064804 100644
--- a/system/gd/hci/acl_manager/le_impl.h
+++ b/system/gd/hci/acl_manager/le_impl.h
@@ -647,7 +647,7 @@
return;
}
if (connect_list.empty()) {
- LOG_ERROR("Attempting to re-arm le connection state machine when filter accept list is empty");
+ LOG_INFO("Ignored request to re-arm le connection state machine when filter accept list is empty");
return;
}
AddressWithType empty(Address::kEmpty, AddressType::RANDOM_DEVICE_ADDRESS);
@@ -847,6 +847,11 @@
}
void cancel_connect(AddressWithType address_with_type) {
+ // Remove any alarms for this peer, if any
+ if (create_connection_timeout_alarms_.find(address_with_type) != create_connection_timeout_alarms_.end()) {
+ create_connection_timeout_alarms_.at(address_with_type).Cancel();
+ create_connection_timeout_alarms_.erase(address_with_type);
+ }
// the connection will be canceled by LeAddressManager.OnPause()
remove_device_from_connect_list(address_with_type);
}