OSDN Git Service

Group similar values L2CA_SetFlushTimeout
authorChris Manton <cmanton@google.com>
Sun, 23 Aug 2020 22:49:22 +0000 (15:49 -0700)
committerChris Manton <cmanton@google.com>
Mon, 24 Aug 2020 15:01:14 +0000 (08:01 -0700)
Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I658fb9b6270783615dfd1fea264f9aeb4bd96485

stack/l2cap/l2c_api.cc

index c697d04..e33a205 100644 (file)
@@ -1226,17 +1226,14 @@ bool L2CA_SetFlushTimeout(const RawAddress& bd_addr,
   if (flush_timeout_in_ms == 0x0000) {
     flush_timeout_in_slots = flush_timeout_in_ms;
     flush_timeout_in_ms = L2CAP_NO_AUTOMATIC_FLUSH;
-  }
-  /* no retransmission */
-  else if (flush_timeout_in_ms == L2CAP_NO_RETRANSMISSION) {
+  } else if (flush_timeout_in_ms == L2CAP_NO_AUTOMATIC_FLUSH) {
+    flush_timeout_in_slots = 0x0000;
+  } else if (flush_timeout_in_ms == L2CAP_NO_RETRANSMISSION) {
+    /* no retransmission */
     /* not mandatory range for controller */
     /* Packet is flushed before getting any ACK/NACK */
     /* To do this, flush timeout should be 1 baseband slot */
     flush_timeout_in_slots = flush_timeout_in_ms;
-  }
-  /* no automatic flush (infinite timeout) */
-  else if (flush_timeout_in_ms == L2CAP_NO_AUTOMATIC_FLUSH) {
-    flush_timeout_in_slots = 0x0000;
   } else {
     flush_timeout_in_slots =
         ConvertMillisecondsToBasebandSlots(flush_timeout_in_ms);