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

Commit 26727ff2 authored by Chris Manton's avatar Chris Manton
Browse files

stack::l2cap [4/19] L2CA_DisconnectReq

Bug: 339732512
Test: m .
Flag: EXEMPT, Logging Change

Change-Id: Idc4822540f314d793879c7ee5006ed0565ae70b6
parent 2374d062
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -141,7 +141,10 @@ void avct_l2c_connect_ind_cback(const RawAddress& bd_addr, uint16_t lcid,

  /* If we reject the connection, send DisconnectReq */
  if (result != L2CAP_CONN_OK) {
    L2CA_DisconnectReq(lcid);
    if (!L2CA_DisconnectReq(lcid)) {
      log::warn("Unable to send L2CAP disconnect request peer:{} cid:{}",
                bd_addr, lcid);
    }
  }

  /* if result ok, proceed with connection */
@@ -189,7 +192,10 @@ static void avct_on_l2cap_error(uint16_t lcid, uint16_t result) {
    p_lcb->ch_result = result;

    /* Send L2CAP disconnect req */
    L2CA_DisconnectReq(lcid);
    if (!L2CA_DisconnectReq(lcid)) {
      log::warn("Unable to send L2CAP disconnect request peer:{} cid:{}",
                p_lcb->peer_addr, lcid);
    }
  }
}

@@ -232,7 +238,10 @@ void avct_l2c_connect_cfm_cback(uint16_t lcid, uint16_t result) {
      if (result == L2CAP_CONN_OK) {
        /* just in case the peer also accepts our connection - Send L2CAP
         * disconnect req */
        L2CA_DisconnectReq(lcid);
        if (!L2CA_DisconnectReq(lcid)) {
          log::warn("Unable to send L2CAP disconnect request peer:{} cid:{}",
                    p_lcb->peer_addr, lcid);
        }
      }
      p_lcb->conflict_lcid = 0;
    }
@@ -324,7 +333,9 @@ void avct_l2c_disconnect_ind_cback(uint16_t lcid, bool ack_needed) {
}

void avct_l2c_disconnect(uint16_t lcid, uint16_t result) {
  L2CA_DisconnectReq(lcid);
  if (!L2CA_DisconnectReq(lcid)) {
    log::warn("Unable to send L2CAP disconnect request cid:{}", lcid);
  }

  tAVCT_LCB* p_lcb;
  uint16_t res;
+10 −3
Original line number Diff line number Diff line
@@ -148,7 +148,9 @@ void avct_l2c_br_connect_ind_cback(const RawAddress& bd_addr, uint16_t lcid,
  /* If we reject the connection, send DisconnectReq */
  if (result != L2CAP_CONN_OK) {
    log::verbose("Connection rejected to lcid:0x{:x}", lcid);
    L2CA_DisconnectReq(lcid);
    if (!L2CA_DisconnectReq(lcid)) {
      log::warn("Unable to send L2CAP disconnect request cid:{}", lcid);
    }
  }

  /* if result ok, proceed with connection */
@@ -213,7 +215,10 @@ void avct_l2c_br_connect_cfm_cback(uint16_t lcid, uint16_t result) {
      /* just in case the peer also accepts our connection - Send L2CAP
       * disconnect req */
      log::verbose("Disconnect conflict_lcid:0x{:x}", p_bcb->conflict_lcid);
      L2CA_DisconnectReq(lcid);
      if (!L2CA_DisconnectReq(lcid)) {
        log::warn("Unable to send L2CAP disconnect request peer:{} cid:{}",
                  p_bcb->peer_addr, lcid);
      }
    }
    p_bcb->conflict_lcid = 0;
  }
@@ -298,7 +303,9 @@ void avct_l2c_br_disconnect_ind_cback(uint16_t lcid, bool ack_needed) {
}

void avct_l2c_br_disconnect(uint16_t lcid, uint16_t result) {
  L2CA_DisconnectReq(lcid);
  if (!L2CA_DisconnectReq(lcid)) {
    log::warn("Unable to send L2CAP disconnect request cid:{}", lcid);
  }

  tAVCT_BCB* p_lcb;
  uint16_t res;
+7 −2
Original line number Diff line number Diff line
@@ -206,7 +206,9 @@ void avdt_l2c_connect_ind_cback(const RawAddress& bd_addr, uint16_t lcid,

  /* If we reject the connection, send DisconnectReq */
  if (result != L2CAP_CONN_OK) {
    L2CA_DisconnectReq(lcid);
    if (!L2CA_DisconnectReq(lcid)) {
      log::warn("Unable to disconnect L2CAP cid:{}", lcid);
    }
    return;
  }

@@ -364,7 +366,10 @@ void avdt_l2c_disconnect_ind_cback(uint16_t lcid, bool ack_needed) {
}

void avdt_l2c_disconnect(uint16_t lcid) {
  L2CA_DisconnectReq(lcid);
  if (!L2CA_DisconnectReq(lcid)) {
    log::warn("Unable to disconnect L2CAP cid:{}", lcid);
  }

  AvdtpTransportChannel* p_tbl;

  log::verbose("avdt_l2c_disconnect_cfm_cback lcid: {}", lcid);
+4 −1
Original line number Diff line number Diff line
@@ -297,7 +297,10 @@ tBNEP_RESULT BNEP_Disconnect(uint16_t handle) {

  log::verbose("BNEP_Disconnect()  for handle {}", handle);

  L2CA_DisconnectReq(p_bcb->l2cap_cid);
  if (!L2CA_DisconnectReq(p_bcb->l2cap_cid)) {
    log::warn("Unable to send L2CAP disconnect request peer:{} cid:{}",
              p_bcb->rem_bda, p_bcb->l2cap_cid);
  }

  bnepu_release_bcb(p_bcb);

+28 −8
Original line number Diff line number Diff line
@@ -118,7 +118,10 @@ static void bnep_connect_ind(const RawAddress& bd_addr, uint16_t l2cap_cid,
  /* no more resources to handle the connection, reject the connection.    */
  if (!(bnep_cb.profile_registered) || (p_bcb) ||
      ((p_bcb = bnepu_allocate_bcb(bd_addr)) == NULL)) {
    L2CA_DisconnectReq(l2cap_cid);
    if (!L2CA_DisconnectReq(l2cap_cid)) {
      log::warn("Unable to request L2CAP disconnect peer:{} cid:{}", bd_addr,
                l2cap_cid);
    }
    return;
  }

@@ -145,7 +148,10 @@ static void bnep_on_l2cap_error(uint16_t l2cap_cid, uint16_t result) {
                               false);
  }

  L2CA_DisconnectReq(p_bcb->l2cap_cid);
  if (!L2CA_DisconnectReq(p_bcb->l2cap_cid)) {
    log::warn("Unable to request L2CAP disconnect peer:{} cid:{}",
              p_bcb->rem_bda, l2cap_cid);
  }

  bnepu_release_bcb(p_bcb);
}
@@ -539,8 +545,10 @@ void bnep_conn_timer_timeout(void* data) {
               p_bcb->l2cap_cid);

    if (!(p_bcb->con_flags & BNEP_FLAGS_IS_ORIG)) {
      L2CA_DisconnectReq(p_bcb->l2cap_cid);

      if (!L2CA_DisconnectReq(p_bcb->l2cap_cid)) {
        log::warn("Unable to request L2CAP disconnect peer:{} cid:{}",
                  p_bcb->rem_bda, p_bcb->l2cap_cid);
      }
      bnepu_release_bcb(p_bcb);
      return;
    }
@@ -550,7 +558,10 @@ void bnep_conn_timer_timeout(void* data) {
      alarm_set_on_mloop(p_bcb->conn_timer, BNEP_CONN_TIMEOUT_MS,
                         bnep_conn_timer_timeout, p_bcb);
    } else {
      L2CA_DisconnectReq(p_bcb->l2cap_cid);
      if (!L2CA_DisconnectReq(p_bcb->l2cap_cid)) {
        log::warn("Unable to request L2CAP disconnect peer:{} cid:{}",
                  p_bcb->rem_bda, p_bcb->l2cap_cid);
      }

      if ((p_bcb->con_flags & BNEP_FLAGS_IS_ORIG) && (bnep_cb.p_conn_state_cb))
        (*bnep_cb.p_conn_state_cb)(p_bcb->handle, p_bcb->rem_bda,
@@ -563,7 +574,10 @@ void bnep_conn_timer_timeout(void* data) {
    log::debug("BNEP - CCB timeout in state: {}  CID: 0x{:x}", p_bcb->con_state,
               p_bcb->l2cap_cid);

    L2CA_DisconnectReq(p_bcb->l2cap_cid);
    if (!L2CA_DisconnectReq(p_bcb->l2cap_cid)) {
      log::warn("Unable to request L2CAP disconnect peer:{} cid:{}",
                p_bcb->rem_bda, p_bcb->l2cap_cid);
    }

    /* Tell the user if there is a callback */
    if ((p_bcb->con_flags & BNEP_FLAGS_IS_ORIG) && (bnep_cb.p_conn_state_cb))
@@ -577,7 +591,10 @@ void bnep_conn_timer_timeout(void* data) {
      alarm_set_on_mloop(p_bcb->conn_timer, BNEP_FILTER_SET_TIMEOUT_MS,
                         bnep_conn_timer_timeout, p_bcb);
    } else {
      L2CA_DisconnectReq(p_bcb->l2cap_cid);
      if (!L2CA_DisconnectReq(p_bcb->l2cap_cid)) {
        log::warn("Unable to request L2CAP disconnect peer:{} cid:{}",
                  p_bcb->rem_bda, p_bcb->l2cap_cid);
      }

      /* Tell the user if there is a callback */
      if (bnep_cb.p_conn_state_cb)
@@ -593,7 +610,10 @@ void bnep_conn_timer_timeout(void* data) {
      alarm_set_on_mloop(p_bcb->conn_timer, BNEP_FILTER_SET_TIMEOUT_MS,
                         bnep_conn_timer_timeout, p_bcb);
    } else {
      L2CA_DisconnectReq(p_bcb->l2cap_cid);
      if (!L2CA_DisconnectReq(p_bcb->l2cap_cid)) {
        log::warn("Unable to request L2CAP disconnect peer:{} cid:{}",
                  p_bcb->rem_bda, p_bcb->l2cap_cid);
      }

      /* Tell the user if there is a callback */
      if (bnep_cb.p_conn_state_cb)
Loading