OSDN Git Service

Fix ACL Manager start_round_robin logic and add log
authorHansong Zhang <hsz@google.com>
Wed, 26 Feb 2020 20:32:23 +0000 (12:32 -0800)
committerHansong Zhang <hsz@google.com>
Thu, 27 Feb 2020 00:18:46 +0000 (16:18 -0800)
Bug: 150174451
Test: cert/run_device_cert.sh
Change-Id: Id27b2bfe710cc8efccc5513a94e2c72160afef27

gd/hci/acl_manager.cc
gd/l2cap/classic/internal/signalling_manager.cc
gd/os/linux_generic/handler.cc
gd/os/linux_generic/queue.tpp

index 80439a2..f4f7365 100644 (file)
@@ -21,9 +21,8 @@
 #include <set>
 #include <utility>
 
-#include "acl_fragmenter.h"
-#include "acl_manager.h"
 #include "common/bidi_queue.h"
+#include "hci/acl_fragmenter.h"
 #include "hci/controller.h"
 #include "hci/hci_layer.h"
 
@@ -245,7 +244,9 @@ struct AclManager::impl {
     connection_pair->second.number_of_sent_packets_ -= credits;
     acl_packet_credits_ += credits;
     ASSERT(acl_packet_credits_ <= max_acl_packet_credits_);
-    start_round_robin();
+    if (acl_packet_credits_ == credits) {
+      start_round_robin();
+    }
   }
 
   // Round-robin scheduler
index 2adf653..7928d3d 100644 (file)
@@ -695,7 +695,7 @@ void ClassicSignallingManager::on_command_timeout() {
     LOG_ERROR("No pending command");
     return;
   }
-
+  LOG_WARN("Response time out for %s", CommandCodeText(command_just_sent_.command_code_).c_str());
   switch (command_just_sent_.command_code_) {
     case CommandCode::CONNECTION_REQUEST: {
       link_->OnOutgoingConnectionRequestFail(command_just_sent_.source_cid_);
index 85cbcc3..146dfff 100644 (file)
@@ -55,6 +55,7 @@ void Handler::Post(OnceClosure closure) {
   {
     std::lock_guard<std::mutex> lock(mutex_);
     if (was_cleared()) {
+      LOG_WARN("Posting to a handler which has been cleared");
       return;
     }
     tasks_->emplace(std::move(closure));
index bd9a292..dd1deff 100644 (file)
@@ -19,8 +19,8 @@ Queue<T>::Queue(size_t capacity) : enqueue_(capacity), dequeue_(0){};
 
 template <typename T>
 Queue<T>::~Queue() {
-  ASSERT(enqueue_.handler_ == nullptr);
-  ASSERT(dequeue_.handler_ == nullptr);
+  ASSERT_LOG(enqueue_.handler_ == nullptr, "Enqueue is not unregistered");
+  ASSERT_LOG(dequeue_.handler_ == nullptr, "Dequeue is not unregistered");
 };
 
 template <typename T>