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

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

Encapsulate tL2C_CB::tL2C_LCB::link_flush_tout_

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Ic8d6f5712129031bd16510d7ba745ae19afbce77
parent 237e23c4
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1245,8 +1245,8 @@ bool L2CA_SetFlushTimeout(const RawAddress& bd_addr, uint16_t flush_tout) {
    p_lcb = l2cu_find_lcb_by_bd_addr(bd_addr, BT_TRANSPORT_BR_EDR);

    if ((p_lcb) && (p_lcb->in_use) && (p_lcb->link_state == LST_CONNECTED)) {
      if (p_lcb->link_flush_tout != flush_tout) {
        p_lcb->link_flush_tout = flush_tout;
      if (p_lcb->LinkFlushTimeout() != flush_tout) {
        p_lcb->SetLinkFlushTimeout(flush_tout);

        VLOG(1) << __func__ << " BDA: " << bd_addr << " " << flush_tout << "ms";

@@ -1262,8 +1262,8 @@ bool L2CA_SetFlushTimeout(const RawAddress& bd_addr, uint16_t flush_tout) {

    for (xx = 0; xx < MAX_L2CAP_LINKS; xx++, p_lcb++) {
      if ((p_lcb->in_use) && (p_lcb->link_state == LST_CONNECTED)) {
        if (p_lcb->link_flush_tout != flush_tout) {
          p_lcb->link_flush_tout = flush_tout;
        if (p_lcb->LinkFlushTimeout() != flush_tout) {
          p_lcb->SetLinkFlushTimeout(flush_tout);

          VLOG(1) << __func__ << " BDA: " << p_lcb->remote_bd_addr << " "
                  << flush_tout << "ms";
+7 −1
Original line number Diff line number Diff line
@@ -361,7 +361,13 @@ typedef struct t_l2c_linkcb {
  void SetBonding() { is_bonding_ = true; }
  void ResetBonding() { is_bonding_ = false; }

  uint16_t link_flush_tout; /* Flush timeout used */
 private:
  uint16_t link_flush_tout_{0}; /* Flush timeout used */
 public:
  uint16_t LinkFlushTimeout() const { return link_flush_tout_; }
  void SetLinkFlushTimeout(uint16_t link_flush_tout) {
    link_flush_tout_ = link_flush_tout;
  }

  uint16_t link_xmit_quota; /* Num outstanding pkts allowed */
  uint16_t sent_not_acked;  /* Num packets sent but not acked */
+3 −3
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ tL2C_LCB* l2cu_allocate_lcb(const RawAddress& p_bd_addr, bool is_bonding,
      p_lcb->in_use = true;
      p_lcb->link_state = LST_DISCONNECTED;
      p_lcb->handle = HCI_INVALID_HANDLE;
      p_lcb->link_flush_tout = 0xFFFF;
      p_lcb->SetLinkFlushTimeout(L2CAP_NO_AUTOMATIC_FLUSH);
      p_lcb->l2c_lcb_timer = alarm_new("l2c_lcb.l2c_lcb_timer");
      p_lcb->info_resp_timer = alarm_new("l2c_lcb.info_resp_timer");
      p_lcb->idle_timeout = l2cb.idle_timeout;
@@ -1959,8 +1959,8 @@ void l2cu_process_our_cfg_req(tL2C_CCB* p_ccb, tL2CAP_CFG_INFO* p_cfg) {
      p_ccb->our_cfg.flush_to = p_cfg->flush_to;
      p_lcb = p_ccb->p_lcb;

      if (p_cfg->flush_to < p_lcb->link_flush_tout) {
        p_lcb->link_flush_tout = p_cfg->flush_to;
      if (p_cfg->flush_to < p_lcb->LinkFlushTimeout()) {
        p_lcb->SetLinkFlushTimeout(p_cfg->flush_to);

        /* If the timeout is within range of HCI, set the flush timeout */
        if (p_cfg->flush_to <= ((HCI_MAX_AUTOMATIC_FLUSH_TIMEOUT * 5) / 8)) {