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

Commit 8e26cacd authored by Chris Manton's avatar Chris Manton
Browse files

Decline l2cap response flag

There is no need for upper layers to send a disconnect
response as it has already been handled.
Clean up channel resources at this point.

Bug: 144171652
Test: CtsVerifier in Gd Mode
Change-Id: Id35a547a1e89883b714e9af4883be5974602dd51
parent 38757349
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@

constexpr size_t kBtHdrSize = sizeof(BT_HDR);
constexpr uint16_t kInvalidConnectionInterfaceDescriptor = 0;
constexpr bool kDisconnectResponseRequired = false;

bool bluetooth::legacy::shim::PsmData::IsPsmAllocated(uint16_t psm) const {
  return psm_to_callback_map_.find(psm) != psm_to_callback_map_.end();
@@ -285,7 +286,11 @@ bool bluetooth::legacy::shim::L2cap::SetCallbacks(
  bluetooth::shim::GetL2cap()->SetConnectionClosedCallback(
      cid, [this](uint16_t cid, int error_code) {
        LOG_DEBUG(LOG_TAG, "OnChannel closed callback cid:%hd", cid);
        cid_to_callback_map_[cid]->pL2CA_DisconnectInd_Cb(cid, true);
        CHECK(cid_to_callback_map_.find(cid) != cid_to_callback_map_.end());
        cid_to_callback_map_[cid]->pL2CA_DisconnectInd_Cb(
            cid, kDisconnectResponseRequired);
        cid_to_callback_map_.erase(cid);
        cid_to_psm_map_.erase(cid);
      });
  return true;
}
@@ -347,7 +352,6 @@ bool bluetooth::legacy::shim::L2cap::DisconnectRequest(uint16_t cid) {
}

bool bluetooth::legacy::shim::L2cap::DisconnectResponse(uint16_t cid) {
  CHECK(ConnectionExists(cid));
  LOG_DEBUG(LOG_TAG,
            "%s Silently dropping client disconnect response as channel is "
            "already disconnected",