OSDN Git Service

Properly retrieve acl_conn stack/acl/btm_acl::btm_read_remote_features_complete
authorChris Manton <cmanton@google.com>
Sun, 13 Dec 2020 18:54:19 +0000 (10:54 -0800)
committerChris Manton <cmanton@google.com>
Wed, 16 Dec 2020 05:06:44 +0000 (21:06 -0800)
Towards encapsulation

Bug: 163134718
Tag: #refactor
Test: gd/cert/run --host

Change-Id: Id19aa6c9dd0c5bb010345e8706a55be05b04fcc0

stack/acl/btm_acl.cc

index f022cce..c732a8d 100644 (file)
@@ -900,14 +900,12 @@ void btm_read_remote_features_complete_raw(uint8_t* p) {
 }
 
 void btm_read_remote_features_complete(uint16_t handle, uint8_t* features) {
-  uint16_t acl_idx = btm_handle_to_acl_index(handle);
-  if (acl_idx >= MAX_L2CAP_LINKS) {
+  tACL_CONN* p_acl_cb = internal_.acl_get_connection_from_handle(handle);
+  if (p_acl_cb == nullptr) {
     LOG_WARN("Unable to find active acl");
     return;
   }
 
-  tACL_CONN* p_acl_cb = &btm_cb.acl_cb_.acl_db[acl_idx];
-
   /* Copy the received features page */
   STREAM_TO_ARRAY(p_acl_cb->peer_lmp_feature_pages[0], features,
                   HCI_FEATURE_BYTES_PER_PAGE);