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

Commit 6d48c78e authored by Chris Manton's avatar Chris Manton
Browse files

dumpsys: Use cache for max size addr/resolution list

Use cached values rather than fresh values from controller to output dumpsys to manage lifecycle issues during shutdown

Bug: 273912385
Test: net_test_main_shim64

Change-Id: I43272e6f9f1bf5955767407893caf75a7da327d3
parent 48ebfc3f
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -192,6 +192,8 @@ class ShadowAcceptlist {

  void Clear() { acceptlist_set_.clear(); }

  uint8_t GetMaxSize() const { return max_acceptlist_size_; }

 private:
  uint8_t max_acceptlist_size_{0};
  std::unordered_set<ConnectAddressWithType> acceptlist_set_;
@@ -239,6 +241,8 @@ class ShadowAddressResolutionList {

  void Clear() { address_resolution_set_.clear(); }

  uint8_t GetMaxSize() const { return max_address_resolution_size_; }

 private:
  uint8_t max_address_resolution_size_{0};
  std::unordered_set<hci::AddressWithType> address_resolution_set_;
@@ -1146,8 +1150,7 @@ struct shim::legacy::Acl::impl {
    }
    const auto acceptlist = shadow_acceptlist_.GetCopy();
    LOG_DEBUG("Shadow le accept list  size:%-3zu controller_max_size:%hhu",
              acceptlist.size(),
              controller_get_interface()->get_ble_acceptlist_size());
              acceptlist.size(), shadow_acceptlist_.GetMaxSize());
    for (auto& entry : acceptlist) {
      LOG_DEBUG("acceptlist:%s", ADDRESS_TO_LOGGABLE_CSTR(entry));
    }
@@ -1178,8 +1181,7 @@ struct shim::legacy::Acl::impl {
    LOG_DUMPSYS(fd,
                "Shadow le accept list              size:%-3zu "
                "controller_max_size:%hhu",
                acceptlist.size(),
                controller_get_interface()->get_ble_acceptlist_size());
                acceptlist.size(), shadow_acceptlist_.GetMaxSize());
    unsigned cnt = 0;
    for (auto& entry : acceptlist) {
      LOG_DUMPSYS(fd, "  %03u %s", ++cnt, ADDRESS_TO_LOGGABLE_CSTR(entry));
@@ -1189,7 +1191,7 @@ struct shim::legacy::Acl::impl {
                "Shadow le address resolution list  size:%-3zu "
                "controller_max_size:%hhu",
                address_resolution_list.size(),
                controller_get_interface()->get_ble_resolving_list_max_size());
                shadow_address_resolution_list_.GetMaxSize());
    cnt = 0;
    for (auto& entry : address_resolution_list) {
      LOG_DUMPSYS(fd, "  %03u %s", ++cnt, ADDRESS_TO_LOGGABLE_CSTR(entry));
+5 −0
Original line number Diff line number Diff line
@@ -779,3 +779,8 @@ TEST_F(MainShimTest, ticks_to_seconds) {
  ASSERT_THAT(kTicksInSec,
              DoubleNear(ticks_to_seconds(kTicks), kMaxAbsoluteError));
}

TEST_F(MainShimTest, DumpConnectionHistory) {
  auto acl = MakeAcl();
  acl->DumpConnectionHistory(1);
}