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

Commit 698b89cf authored by Łukasz Rymanowski's avatar Łukasz Rymanowski Committed by Jakub Pawlowski
Browse files

eatt: Fix eatt counter in tcb

Problem visible in unit tests

Tag: #feature
Bug: 159786353
Sponsor: jpawlowski@
Test: atest --host net_test_eatt
Change-Id: I8ee1985dee87bb73d127ebfee3ca8e5287975914
parent 497c7013
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -93,7 +93,6 @@ struct eatt_impl {

  void remove_channel_by_cid(eatt_device* eatt_dev, uint16_t lcid) {
    eatt_dev->eatt_channels.erase(lcid);
    eatt_dev->eatt_tcb_->eatt--;

    if (eatt_dev->eatt_channels.size() == 0) eatt_dev->eatt_tcb_ = NULL;
  }
@@ -240,7 +239,14 @@ struct eatt_impl {

  void eatt_l2cap_disconnect_ind(uint16_t lcid, bool please_confirm) {
    LOG(INFO) << __func__ << " cid: " << loghex(lcid);
    remove_channel_by_cid(lcid);
    eatt_device* eatt_dev = find_device_by_cid(lcid);
    if (!eatt_dev) {
      LOG(ERROR) << __func__ << " unknown cid: " << loghex(lcid);
      return;
    }

    eatt_dev->eatt_tcb_->eatt--;
    remove_channel_by_cid(eatt_dev, lcid);
  }

  void eatt_l2cap_data_ind(uint16_t lcid, BT_HDR* data_p) {
+1 −0
Original line number Diff line number Diff line
@@ -445,6 +445,7 @@ tGATT_TCB* gatt_allocate_tcb_by_bdaddr(const RawAddress& bda,
    p_tcb->tcb_idx = i;
    p_tcb->transport = transport;
    p_tcb->peer_bda = bda;
    p_tcb->eatt = 0;
    return p_tcb;
  }