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

Commit 94e0e3a9 authored by Myles Watson's avatar Myles Watson
Browse files

AclManager: Use local handler for round robin

Bug: 145832107
Test: ./cert/run --host && bluetooth_test_gd
Change-Id: I07896917633b0a578cd19e378feb1b7b54746d06
parent 67db4ee0
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -112,10 +112,8 @@ struct classic_impl : public DisconnectorForLe, public security::ISecurityManage
  void on_classic_disconnect(uint16_t handle, ErrorCode reason) {
    if (acl_connections_.count(handle) == 1) {
      auto& connection = acl_connections_.find(handle)->second;
      hci_layer_->GetHciHandler()->Post(
          common::BindOnce(&RoundRobinScheduler::SetDisconnect, common::Unretained(round_robin_scheduler_), handle));
      hci_layer_->GetHciHandler()->Post(
          common::BindOnce(&RoundRobinScheduler::Unregister, common::Unretained(round_robin_scheduler_), handle));
      round_robin_scheduler_->SetDisconnect(handle);
      round_robin_scheduler_->Unregister(handle);
      connection.connection_management_callbacks_->OnDisconnection(reason);
      acl_connections_.erase(handle);
    }
@@ -216,9 +214,7 @@ struct classic_impl : public DisconnectorForLe, public security::ISecurityManage
    acl_connections_.emplace(std::piecewise_construct, std::forward_as_tuple(handle),
                             std::forward_as_tuple(AddressWithType{address, AddressType::PUBLIC_DEVICE_ADDRESS},
                                                   queue->GetDownEnd(), handler_));
    hci_layer_->GetHciHandler()->Post(common::BindOnce(&RoundRobinScheduler::Register,
                                                       common::Unretained(round_robin_scheduler_),
                                                       RoundRobinScheduler::ConnectionType::CLASSIC, handle, queue));
    round_robin_scheduler_->Register(RoundRobinScheduler::ConnectionType::CLASSIC, handle, queue);
    std::unique_ptr<ClassicAclConnection> connection(new ClassicAclConnection(
        std::move(queue), acl_connection_interface_, handle, address, Role::MASTER /* TODO: Did we connect? */));
    auto& connection_proxy = check_and_get_connection(handle);
+4 −10
Original line number Diff line number Diff line
@@ -92,10 +92,8 @@ struct le_impl {
  void on_le_disconnect(uint16_t handle, ErrorCode reason) {
    if (le_acl_connections_.count(handle) == 1) {
      auto& connection = le_acl_connections_.find(handle)->second;
      hci_layer_->GetHciHandler()->Post(
          common::BindOnce(&RoundRobinScheduler::SetDisconnect, common::Unretained(round_robin_scheduler_), handle));
      hci_layer_->GetHciHandler()->Post(
          common::BindOnce(&RoundRobinScheduler::Unregister, common::Unretained(round_robin_scheduler_), handle));
      round_robin_scheduler_->SetDisconnect(handle);
      round_robin_scheduler_->Unregister(handle);
      connection.le_connection_management_callbacks_->OnDisconnection(reason);
      le_acl_connections_.erase(handle);
    }
@@ -135,9 +133,7 @@ struct le_impl {
    auto& connection_proxy = check_and_get_le_connection(handle);
    auto do_disconnect =
        common::BindOnce(&DisconnectorForLe::handle_disconnect, common::Unretained(disconnector_), handle);
    hci_layer_->GetHciHandler()->Post(common::BindOnce(&RoundRobinScheduler::Register,
                                                       common::Unretained(round_robin_scheduler_),
                                                       RoundRobinScheduler::ConnectionType::LE, handle, queue));
    round_robin_scheduler_->Register(RoundRobinScheduler::ConnectionType::LE, handle, queue);
    std::unique_ptr<LeAclConnection> connection(new LeAclConnection(std::move(queue), le_acl_connection_interface_,
                                                                    std::move(do_disconnect), handle, local_address,
                                                                    remote_address, role));
@@ -172,9 +168,7 @@ struct le_impl {
    le_acl_connections_.emplace(std::piecewise_construct, std::forward_as_tuple(handle),
                                std::forward_as_tuple(remote_address, queue->GetDownEnd(), handler_));
    auto& connection_proxy = check_and_get_le_connection(handle);
    hci_layer_->GetHciHandler()->Post(common::BindOnce(&RoundRobinScheduler::Register,
                                                       common::Unretained(round_robin_scheduler_),
                                                       RoundRobinScheduler::ConnectionType::LE, handle, queue));
    round_robin_scheduler_->Register(RoundRobinScheduler::ConnectionType::LE, handle, queue);
    auto role = connection_complete.GetRole();
    auto do_disconnect =
        common::BindOnce(&DisconnectorForLe::handle_disconnect, common::Unretained(disconnector_), handle);
+0 −4
Original line number Diff line number Diff line
@@ -79,10 +79,6 @@ class HciLayer : public Module, public CommandInterface<CommandPacketBuilder> {

  virtual LeScanningInterface* GetLeScanningInterface(common::ContextualCallback<void(LeMetaEventView)> event_handler);

  os::Handler* GetHciHandler() {
    return GetHandler();
  }

  std::string ToString() const override {
    return "Hci Layer";
  }