OSDN Git Service

L2CA_ConfigRsp is always invoked with status OK
authorHansong Zhang <hsz@google.com>
Fri, 25 Sep 2020 06:28:56 +0000 (23:28 -0700)
committerHansong Zhang <hsz@google.com>
Sat, 26 Sep 2020 01:06:40 +0000 (18:06 -0700)
So we can move some error processing logic.

Also we never send a config with continuation flag.

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I6c5e05b39a76138f90b41a0e56b7bfd73f056455

stack/l2cap/l2c_api.cc
stack/l2cap/l2c_csm.cc
stack/l2cap/l2c_int.h

index 57c1552..1ae7cea 100644 (file)
@@ -917,20 +917,7 @@ bool L2CA_ConfigRsp(uint16_t cid, tL2CAP_CFG_INFO* p_cfg) {
     return (false);
   }
 
-  if ((p_cfg->result == L2CAP_CFG_OK) || (p_cfg->result == L2CAP_CFG_PENDING))
-    l2c_csm_execute(p_ccb, L2CEVT_L2CA_CONFIG_RSP, p_cfg);
-  else {
-    p_cfg->fcr_present =
-        false; /* FCR options already negotiated before this point */
-
-    /* Clear out any cached options that are being returned as an error
-     * (excluding FCR) */
-    if (p_cfg->mtu_present) p_ccb->peer_cfg.mtu_present = false;
-    if (p_cfg->flush_to_present) p_ccb->peer_cfg.flush_to_present = false;
-    if (p_cfg->qos_present) p_ccb->peer_cfg.qos_present = false;
-
-    l2c_csm_execute(p_ccb, L2CEVT_L2CA_CONFIG_RSP_NEG, p_cfg);
-  }
+  l2c_csm_execute(p_ccb, L2CEVT_L2CA_CONFIG_RSP, p_cfg);
 
   return (true);
 }
index 1be0fc9..9f7a3e7 100644 (file)
@@ -848,14 +848,6 @@ static void l2c_csm_config(tL2C_CCB* p_ccb, uint16_t event, void* p_data) {
     case L2CEVT_L2CA_CONFIG_RSP: /* Upper layer config rsp   */
       l2cu_process_our_cfg_rsp(p_ccb, p_cfg);
 
-      /* Not finished if continuation flag is set */
-      if ((p_cfg->flags & L2CAP_CFG_FLAGS_MASK_CONT) ||
-          (p_cfg->result == L2CAP_CFG_PENDING)) {
-        /* Send intermediate response; remain in cfg state */
-        l2cu_send_peer_config_rsp(p_ccb, p_cfg);
-        break;
-      }
-
       /* Local config done; clear cached configuration in case reconfig takes
        * place later */
       p_ccb->peer_cfg.mtu_present = false;
@@ -895,12 +887,6 @@ static void l2c_csm_config(tL2C_CCB* p_ccb, uint16_t event, void* p_data) {
       }
       break;
 
-    case L2CEVT_L2CA_CONFIG_RSP_NEG: /* Upper layer config reject */
-      l2cu_send_peer_config_rsp(p_ccb, p_cfg);
-      alarm_set_on_mloop(p_ccb->l2c_ccb_timer, L2CAP_CHNL_CFG_TIMEOUT_MS,
-                         l2c_ccb_timer_timeout, p_ccb);
-      break;
-
     case L2CEVT_L2CA_DISCONNECT_REQ: /* Upper wants to disconnect */
       l2cu_send_peer_disc_req(p_ccb);
       p_ccb->chnl_state = CST_W4_L2CAP_DISCONNECT_RSP;
@@ -1257,8 +1243,6 @@ static const char* l2c_csm_get_event_name(uint16_t event) {
       return ("UPPER_LAYER_CONFIG_REQ");
     case L2CEVT_L2CA_CONFIG_RSP: /* Upper layer config response          */
       return ("UPPER_LAYER_CONFIG_RSP");
-    case L2CEVT_L2CA_CONFIG_RSP_NEG: /* Upper layer config response (failed) */
-      return ("UPPER_LAYER_CONFIG_RSP_NEG");
     case L2CEVT_L2CA_DISCONNECT_REQ: /* Upper layer disconnect request       */
       return ("UPPER_LAYER_DISCONNECT_REQ");
     case L2CEVT_L2CA_DISCONNECT_RSP: /* Upper layer disconnect response      */
index 057113f..adec13d 100644 (file)
@@ -123,7 +123,6 @@ typedef enum {
 #define L2CEVT_L2CA_CONNECT_RSP_NEG 23 /* connect response (failed)*/
 #define L2CEVT_L2CA_CONFIG_REQ 24      /* config request */
 #define L2CEVT_L2CA_CONFIG_RSP 25      /* config response */
-#define L2CEVT_L2CA_CONFIG_RSP_NEG 26  /* config response (failed) */
 #define L2CEVT_L2CA_DISCONNECT_REQ 27  /* disconnect request */
 #define L2CEVT_L2CA_DISCONNECT_RSP 28  /* disconnect response */
 #define L2CEVT_L2CA_DATA_READ 29       /* data read */