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

Commit ab18ade9 authored by Chris Manton's avatar Chris Manton
Browse files

gd: Add local/remote acl connection initiator bit

Report the initiator of the acl connection.

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

Change-Id: If123478fd271f9f49ff9a3d0e30be8a9a6e1abfd
parent 8ea4de7f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -41,6 +41,8 @@ class AclConnection {
  using QueueDownEnd = common::BidiQueueEnd<PacketView<kLittleEndian>, BasePacketBuilder>;
  virtual QueueUpEnd* GetAclQueueEnd() const;

  bool locally_initiated_{false};

 protected:
  AclConnection(QueueUpEnd* queue_up_end, uint16_t handle) : queue_up_end_(queue_up_end), handle_(handle) {}
  QueueUpEnd* queue_up_end_;
+3 −0
Original line number Diff line number Diff line
@@ -190,9 +190,11 @@ struct classic_impl : public security::ISecurityManagerListener {
    auto status = connection_complete.GetStatus();
    auto address = connection_complete.GetBdAddr();
    Role current_role = Role::CENTRAL;
    bool locally_initiated = true;
    if (outgoing_connecting_address_ == address) {
      outgoing_connecting_address_ = Address::kEmpty;
    } else {
      locally_initiated = false;
      ASSERT_LOG(incoming_connecting_address_ == address, "No prior connection request for %s",
                 address.ToString().c_str());
      incoming_connecting_address_ = Address::kEmpty;
@@ -212,6 +214,7 @@ struct classic_impl : public security::ISecurityManagerListener {
    round_robin_scheduler_->Register(RoundRobinScheduler::ConnectionType::CLASSIC, handle, queue);
    std::unique_ptr<ClassicAclConnection> connection(
        new ClassicAclConnection(std::move(queue), acl_connection_interface_, handle, address));
    connection->locally_initiated_ = locally_initiated;
    auto& connection_proxy = check_and_get_connection(handle);
    connection_proxy.connection_management_callbacks_ = connection->GetEventCallbacks();
    connection_proxy.connection_management_callbacks_->OnRoleChange(current_role);