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

Commit 476f0434 authored by Chris Manton's avatar Chris Manton Committed by Jack He
Browse files

Use proper resolved address upon connection fail or timeout

Also add LOG_ERROR for error path

Bug: 235552757
Test: gd/cert/run
Tag: #refactor
BYPASS_LONG_LINES_REASON: Bluetooth likes 120 lines
Ignore-AOSP-First: Cherry-pick

Merged-In: I5086ad669df914cfbe3f2a0f7c5e3100c6aaee7a
Change-Id: I5086ad669df914cfbe3f2a0f7c5e3100c6aaee7a
parent 8c9de96f
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -147,8 +147,15 @@ void acl_ble_connection_fail(const tBLE_BD_ADDR& address_with_type,
  if (status != HCI_ERR_ADVERTISING_TIMEOUT) {
    btm_cb.ble_ctr_cb.set_connection_state_idle();
    btm_ble_clear_topology_mask(BTM_BLE_STATE_INIT_BIT);
    tBLE_BD_ADDR resolved_address_with_type;
    maybe_resolve_received_address(address_with_type,
                                   &resolved_address_with_type);
    connection_manager::on_connection_timed_out_from_shim(
        address_with_type.bda);
        resolved_address_with_type.bda);
    LOG_WARN("LE connection fail peer:%s bd_addr:%s hci_status:%s",
             PRIVATE_ADDRESS(address_with_type),
             PRIVATE_ADDRESS(resolved_address_with_type.bda),
             hci_status_code_text(status).c_str());
  } else {
    btm_cb.ble_ctr_cb.inq_var.adv_mode = BTM_BLE_ADV_DISABLE;
  }
+7 −1
Original line number Diff line number Diff line
@@ -1567,7 +1567,13 @@ void gatt_cleanup_upon_disc(const RawAddress& bda, tGATT_DISCONN_REASON reason,
  VLOG(1) << __func__;

  tGATT_TCB* p_tcb = gatt_find_tcb_by_addr(bda, transport);
  if (!p_tcb) return;
  if (!p_tcb) {
    LOG_ERROR(
        "Disconnect for unknown connection bd_addr:%s reason:%s transport:%s",
        PRIVATE_ADDRESS(bda), gatt_disconnection_reason_text(reason).c_str(),
        bt_transport_text(transport).c_str());
    return;
  }

  gatt_set_ch_state(p_tcb, GATT_CH_CLOSE);
  for (uint8_t i = 0; i < GATT_CL_MAX_LCB; i++) {