OSDN Git Service

Add API tL2C_LCB::number_of_active_dynamic_channels
authorChris Manton <cmanton@google.com>
Thu, 19 Nov 2020 00:24:42 +0000 (16:24 -0800)
committerChris Manton <cmanton@google.com>
Thu, 10 Dec 2020 18:46:06 +0000 (10:46 -0800)
Toward loggable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run --host

Change-Id: I9a568d60c444c1ec9811f4fd42ac3b371318aad2

stack/l2cap/l2c_int.h

index c107d8e..23766aa 100644 (file)
@@ -493,6 +493,16 @@ typedef struct t_l2c_linkcb {
 
   uint16_t pending_lead_cid;
   uint16_t pending_l2cap_result;
+
+  unsigned number_of_active_dynamic_channels() const {
+    unsigned cnt = 0;
+    const tL2C_CCB* cur = ccb_queue.p_first_ccb;
+    while (cur != nullptr) {
+      cnt++;
+      cur = cur->p_next_ccb;
+    }
+    return cnt;
+  }
 } tL2C_LCB;
 
 /* Define the L2CAP control structure