Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1eff6dc5 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Get rid of is_ble_connecting and ble_connecting_bda

These variables make no sense any more, as we might be attempting
multiple connections at the same time.

Test: sl4a GattConnectTest, manual bonding test
Bug: 112827989
Change-Id: I7e1d01e8d80383b49ff9c20fb3758cef03c52882
parent cd33d930
Loading
Loading
Loading
Loading
+1 −17
Original line number Diff line number Diff line
@@ -60,8 +60,7 @@ bool L2CA_CancelBleConnectReq(const RawAddress& rem_bda) {

  tACL_CONN* p_acl = btm_bda_to_acl(rem_bda, BT_TRANSPORT_LE);
  if (p_acl) {
    if (p_lcb != NULL && p_lcb->link_state == LST_CONNECTING &&
        !l2cb.is_ble_connecting) {
    if (p_lcb != NULL && p_lcb->link_state == LST_CONNECTING) {
      L2CAP_TRACE_WARNING("%s - disconnecting the LE link", __func__);
      L2CA_RemoveFixedChnl(L2CAP_ATT_CID, rem_bda);
      return (true);
@@ -269,10 +268,6 @@ void l2cble_conn_comp(uint16_t handle, uint8_t role, const RawAddress& bda,
      "slave_latency=%d supervision_tout=%d",
      __func__, handle, type, conn_interval, conn_latency, conn_timeout);

  if (role == HCI_ROLE_MASTER) {
    l2cb.is_ble_connecting = false;
  }

  /* See if we have a link control block for the remote device */
  tL2C_LCB* p_lcb = l2cu_find_lcb_by_bd_addr(bda, BT_TRANSPORT_LE);

@@ -334,11 +329,6 @@ void l2cble_conn_comp(uint16_t handle, uint8_t role, const RawAddress& bda,
      p_lcb->link_state = LST_CONNECTED;
      l2cu_process_fixed_chnl_resp(p_lcb);
    }

    /* when adv and initiating are both active, cancel the direct connection */
    if (l2cb.is_ble_connecting && bda == l2cb.ble_connecting_bda) {
      L2CA_CancelBleConnectReq(bda);
    }
  }
}

@@ -776,12 +766,6 @@ bool l2cble_create_conn(tL2C_LCB* p_lcb) {

  p_lcb->link_state = LST_CONNECTING;

  // TODO(jpawlowski): these variables make no sense any more, as we might be
  // attempting multiple connections at same time. Get rid of them in next
  // patch.
  l2cb.is_ble_connecting = true;
  l2cb.ble_connecting_bda = p_lcb->remote_bd_addr;

  // TODO: we should not need this timer at all, the connection failure should
  // be reported from lower layer
  alarm_set_on_mloop(p_lcb->l2c_lcb_timer, L2CAP_BLE_LINK_CONNECT_TIMEOUT_MS,
+0 −2
Original line number Diff line number Diff line
@@ -506,8 +506,6 @@ typedef struct {
#endif

  uint16_t num_ble_links_active; /* Number of LE links active */
  bool is_ble_connecting;
  RawAddress ble_connecting_bda;
  uint16_t controller_le_xmit_window; /* Total ACL window for all links */
  tL2C_BLE_FIXED_CHNLS_MASK l2c_ble_fixed_chnls_mask;  // LE fixed channels mask
  uint16_t num_lm_ble_bufs;         /* # of ACL buffers on controller */
+1 −4
Original line number Diff line number Diff line
@@ -413,7 +413,6 @@ bool l2c_link_hci_disc_comp(uint16_t handle, uint8_t reason) {
      /* for LE link, always drop and re-open to ensure to get LE remote feature
       */
      if (p_lcb->transport == BT_TRANSPORT_LE) {
        l2cb.is_ble_connecting = false;
        btm_acl_removed(p_lcb->remote_bd_addr, p_lcb->transport);
      } else {
#if (L2CAP_NUM_FIXED_CHNLS > 0)
@@ -534,9 +533,7 @@ void l2c_link_timeout(tL2C_LCB* p_lcb) {

      p_ccb = pn;
    }
    if (p_lcb->link_state == LST_CONNECTING && l2cb.is_ble_connecting) {
      L2CA_CancelBleConnectReq(l2cb.ble_connecting_bda);
    }

    /* Release the LCB */
    l2cu_release_lcb(p_lcb);
  }
+1 −7
Original line number Diff line number Diff line
@@ -171,11 +171,6 @@ void l2cu_release_lcb(tL2C_LCB* p_lcb) {
    }
  }

  // Reset BLE connecting flag only if the address matches
  if (p_lcb->transport == BT_TRANSPORT_LE &&
      l2cb.ble_connecting_bda == p_lcb->remote_bd_addr)
    l2cb.is_ble_connecting = false;

#if (L2CAP_NUM_FIXED_CHNLS > 0)
  l2cu_process_fixed_disc_cback(p_lcb);
#endif
@@ -1633,7 +1628,7 @@ void l2cu_release_ccb(tL2C_CCB* p_ccb) {
        /* Link is still active, adjust channel quotas. */
        l2c_link_adjust_chnl_allocation();
      }
    } else if (p_lcb->link_state == LST_CONNECTING && !l2cb.is_ble_connecting) {
    } else if (p_lcb->link_state == LST_CONNECTING) {
      if (!p_lcb->ccb_queue.p_first_ccb) {
        if (p_lcb->transport == BT_TRANSPORT_LE &&
            p_ccb->local_cid == L2CAP_ATT_CID) {
@@ -2107,7 +2102,6 @@ void l2cu_device_reset(void) {
      l2c_link_hci_disc_comp(p_lcb->handle, (uint8_t)-1);
    }
  }
  l2cb.is_ble_connecting = false;
}

bool l2cu_create_conn_le(tL2C_LCB* p_lcb) {