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

Commit 804607b5 authored by Chris Manton's avatar Chris Manton
Browse files

Re-log stack/l2cap/l2c_ble::l2cble_conn_comp

Towards loggable code

Bug: 163134718
Tag: #refactor
Test: act.py -tc BleCocTest
Test: ble paired 2 phones
Test: classic paired Bose SoundLink
Change-Id: I6dfd621e83868b36fdb1ac16825db8176600adb9
parent 7b4864a4
Loading
Loading
Loading
Loading
+5 −9
Original line number Diff line number Diff line
@@ -272,11 +272,6 @@ void l2cble_conn_comp(uint16_t handle, uint8_t role, const RawAddress& bda,
  // role == HCI_ROLE_MASTER => scanner completed connection
  // role == HCI_ROLE_SLAVE => advertiser completed connection

  L2CAP_TRACE_DEBUG(
      "%s: HANDLE=%d addr_type=%d conn_interval=%d "
      "slave_latency=%d supervision_tout=%d",
      __func__, handle, type, conn_interval, conn_latency, conn_timeout);

  /* 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);

@@ -285,18 +280,19 @@ void l2cble_conn_comp(uint16_t handle, uint8_t role, const RawAddress& bda,
    p_lcb = l2cu_allocate_lcb(bda, false, BT_TRANSPORT_LE);
    if (!p_lcb) {
      btm_sec_disconnect(handle, HCI_ERR_NO_CONNECTION);
      LOG(ERROR) << __func__ << "failed to allocate LCB";
      LOG_ERROR("Unable to allocate link resource for le acl connection");
      return;
    } else {
      if (!l2cu_initialize_fixed_ccb(p_lcb, L2CAP_ATT_CID)) {
        btm_sec_disconnect(handle, HCI_ERR_NO_CONNECTION);
        LOG(WARNING) << __func__ << "LCB but no CCB";
        LOG_ERROR("Unable to allocate channel resource for le acl connection");
        return;
      }
    }
  } else if (role == HCI_ROLE_MASTER && p_lcb->link_state != LST_CONNECTING) {
    LOG(ERROR) << "L2CAP got BLE scanner conn_comp in bad state: "
               << +p_lcb->link_state;
    LOG_ERROR(
        "Received le acl connection as role master but not in connecting "
        "state");
    return;
  }