OSDN Git Service

Remove tBTM_CB::discing can never be true
authorChris Manton <cmanton@google.com>
Fri, 18 Sep 2020 01:08:20 +0000 (18:08 -0700)
committerChris Manton <cmanton@google.com>
Mon, 21 Sep 2020 20:10:25 +0000 (20:10 +0000)
Towards readable code

Bug: 163134718
Tag: #refactor
Test: acts -tc BleCocTest
Test: ble paired 2 phones

Change-Id: I9ab220375763f1bf8959ace85ef1fc02eca81bd5

stack/acl/btm_acl.cc
stack/btm/btm_int_types.h
stack/btm/btm_sec.cc

index a12f026..2e49a77 100644 (file)
@@ -2329,30 +2329,22 @@ void btm_acl_reset_paging(void) {
 void btm_acl_paging(BT_HDR* p, const RawAddress& bda) {
   tBTM_SEC_DEV_REC* p_dev_rec;
 
-  VLOG(2) << __func__ << ":" << btm_cb.discing << " , paging:" << btm_cb.paging
-          << " BDA: " << bda;
-
-  if (btm_cb.discing) {
-    btm_cb.paging = true;
-    fixed_queue_enqueue(btm_cb.page_queue, p);
-  } else {
-    if (!BTM_IsAclConnectionUp(bda, BT_TRANSPORT_BR_EDR)) {
-      VLOG(1) << "connecting_bda: " << btm_cb.connecting_bda;
-      if (btm_cb.paging && bda == btm_cb.connecting_bda) {
-        fixed_queue_enqueue(btm_cb.page_queue, p);
-      } else {
-        p_dev_rec = btm_find_or_alloc_dev(bda);
-        btm_cb.connecting_bda = p_dev_rec->bd_addr;
-        memcpy(btm_cb.connecting_dc, p_dev_rec->dev_class, DEV_CLASS_LEN);
-
-        btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
-      }
+  if (!BTM_IsAclConnectionUp(bda, BT_TRANSPORT_BR_EDR)) {
+    VLOG(1) << "connecting_bda: " << btm_cb.connecting_bda;
+    if (btm_cb.paging && bda == btm_cb.connecting_bda) {
+      fixed_queue_enqueue(btm_cb.page_queue, p);
+    } else {
+      p_dev_rec = btm_find_or_alloc_dev(bda);
+      btm_cb.connecting_bda = p_dev_rec->bd_addr;
+      memcpy(btm_cb.connecting_dc, p_dev_rec->dev_class, DEV_CLASS_LEN);
 
-      btm_cb.paging = true;
-    } else /* ACL is already up */
-    {
       btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
     }
+
+    btm_cb.paging = true;
+  } else /* ACL is already up */
+  {
+    btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
   }
 }
 
index 45801bc..4814843 100644 (file)
@@ -260,7 +260,6 @@ typedef struct {
   bool is_inquiry;    /* true, if inquiry is in progess */
   fixed_queue_t* page_queue;
   bool paging;
-  bool discing;
   fixed_queue_t* sec_pending_q; /* pending sequrity requests in
                                    tBTM_SEC_QUEUE_ENTRY format */
 
index 64c7ca6..ba27380 100644 (file)
@@ -3706,9 +3706,6 @@ void btm_sec_disconnected(uint16_t handle, uint8_t reason) {
   tBTM_SEC_CALLBACK* p_callback = NULL;
   tBT_TRANSPORT transport = BT_TRANSPORT_BR_EDR;
 
-  /* If page was delayed for disc complete, can do it now */
-  btm_cb.discing = false;
-
   btm_acl_resubmit_page();
 
   if (!p_dev_rec) return;