Loading system/gd/l2cap/classic/internal/link.cc +0 −2 Original line number Diff line number Diff line Loading @@ -43,8 +43,6 @@ Link::Link(os::Handler* l2cap_handler, std::unique_ptr<hci::AclConnection> acl_c ASSERT(acl_connection_ != nullptr); ASSERT(scheduler_ != nullptr); ASSERT(parameter_provider_ != nullptr); acl_connection_->RegisterDisconnectCallback(common::BindOnce(&Link::OnAclDisconnected, common::Unretained(this)), l2cap_handler_); link_idle_disconnect_alarm_.Schedule(common::BindOnce(&Link::Disconnect, common::Unretained(this)), parameter_provider_->GetClassicLinkIdleDisconnectTimeout()); } Loading system/gd/l2cap/classic/internal/link_manager.cc +3 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,9 @@ void LinkManager::OnConnectSuccess(std::unique_ptr<hci::AclConnection> acl_conne hci::Address device = acl_connection->GetAddress(); ASSERT_LOG(GetLink(device) == nullptr, "%s is connected twice without disconnection", acl_connection->GetAddress().ToString().c_str()); // Register ACL disconnection callback in LinkManager so that we can clean up link resource properly acl_connection->RegisterDisconnectCallback( common::BindOnce(&LinkManager::OnDisconnect, common::Unretained(this), device), l2cap_handler_); auto* link_queue_up_end = acl_connection->GetAclQueueEnd(); links_.try_emplace(device, l2cap_handler_, std::move(acl_connection), std::make_unique<l2cap::internal::Fifo>(link_queue_up_end, l2cap_handler_), parameter_provider_, Loading system/gd/l2cap/classic/internal/link_manager_test.cc +1 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,7 @@ TEST_F(L2capClassicLinkManagerTest, connect_fixed_channel_service_without_acl) { std::unique_ptr<MockAclConnection> acl_connection = std::make_unique<MockAclConnection>(); hci::AclConnection::Queue link_queue{10}; EXPECT_CALL(*acl_connection, GetAclQueueEnd()).WillRepeatedly((Return(link_queue.GetUpEnd()))); EXPECT_CALL(*acl_connection, RegisterDisconnectCallback(_, l2cap_handler_)).Times(1); EXPECT_CALL(*acl_connection, GetAddress()).WillRepeatedly(Return(device)); std::unique_ptr<FixedChannel> channel_1, channel_2; EXPECT_CALL(mock_service_1, NotifyChannelCreation(_)).WillOnce([&channel_1](std::unique_ptr<FixedChannel> channel) { Loading system/gd/l2cap/le/internal/link.h +0 −2 Original line number Diff line number Diff line Loading @@ -41,8 +41,6 @@ class Link { ASSERT(acl_connection_ != nullptr); ASSERT(scheduler_ != nullptr); ASSERT(parameter_provider_ != nullptr); acl_connection_->RegisterDisconnectCallback(common::BindOnce(&Link::OnAclDisconnected, common::Unretained(this)), l2cap_handler_); link_idle_disconnect_alarm_.Schedule(common::BindOnce(&Link::Disconnect, common::Unretained(this)), parameter_provider_->GetLeLinkIdleDisconnectTimeout()); } Loading system/gd/l2cap/le/internal/link_manager.cc +4 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,10 @@ void LinkManager::OnLeConnectSuccess(hci::AddressWithType connecting_address_wit ASSERT_LOG(GetLink(connected_address_with_type) == nullptr, "%s is connected twice without disconnection", acl_connection->GetAddress().ToString().c_str()); auto* link_queue_up_end = acl_connection->GetAclQueueEnd(); // Register ACL disconnection callback in LinkManager so that we can clean up link resource properly acl_connection->RegisterDisconnectCallback( common::BindOnce(&LinkManager::OnDisconnect, common::Unretained(this), connected_address_with_type), l2cap_handler_); links_.try_emplace(connected_address_with_type, l2cap_handler_, std::move(acl_connection), std::make_unique<l2cap::internal::Fifo>(link_queue_up_end, l2cap_handler_), parameter_provider_); auto* link = GetLink(connected_address_with_type); Loading Loading
system/gd/l2cap/classic/internal/link.cc +0 −2 Original line number Diff line number Diff line Loading @@ -43,8 +43,6 @@ Link::Link(os::Handler* l2cap_handler, std::unique_ptr<hci::AclConnection> acl_c ASSERT(acl_connection_ != nullptr); ASSERT(scheduler_ != nullptr); ASSERT(parameter_provider_ != nullptr); acl_connection_->RegisterDisconnectCallback(common::BindOnce(&Link::OnAclDisconnected, common::Unretained(this)), l2cap_handler_); link_idle_disconnect_alarm_.Schedule(common::BindOnce(&Link::Disconnect, common::Unretained(this)), parameter_provider_->GetClassicLinkIdleDisconnectTimeout()); } Loading
system/gd/l2cap/classic/internal/link_manager.cc +3 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,9 @@ void LinkManager::OnConnectSuccess(std::unique_ptr<hci::AclConnection> acl_conne hci::Address device = acl_connection->GetAddress(); ASSERT_LOG(GetLink(device) == nullptr, "%s is connected twice without disconnection", acl_connection->GetAddress().ToString().c_str()); // Register ACL disconnection callback in LinkManager so that we can clean up link resource properly acl_connection->RegisterDisconnectCallback( common::BindOnce(&LinkManager::OnDisconnect, common::Unretained(this), device), l2cap_handler_); auto* link_queue_up_end = acl_connection->GetAclQueueEnd(); links_.try_emplace(device, l2cap_handler_, std::move(acl_connection), std::make_unique<l2cap::internal::Fifo>(link_queue_up_end, l2cap_handler_), parameter_provider_, Loading
system/gd/l2cap/classic/internal/link_manager_test.cc +1 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,7 @@ TEST_F(L2capClassicLinkManagerTest, connect_fixed_channel_service_without_acl) { std::unique_ptr<MockAclConnection> acl_connection = std::make_unique<MockAclConnection>(); hci::AclConnection::Queue link_queue{10}; EXPECT_CALL(*acl_connection, GetAclQueueEnd()).WillRepeatedly((Return(link_queue.GetUpEnd()))); EXPECT_CALL(*acl_connection, RegisterDisconnectCallback(_, l2cap_handler_)).Times(1); EXPECT_CALL(*acl_connection, GetAddress()).WillRepeatedly(Return(device)); std::unique_ptr<FixedChannel> channel_1, channel_2; EXPECT_CALL(mock_service_1, NotifyChannelCreation(_)).WillOnce([&channel_1](std::unique_ptr<FixedChannel> channel) { Loading
system/gd/l2cap/le/internal/link.h +0 −2 Original line number Diff line number Diff line Loading @@ -41,8 +41,6 @@ class Link { ASSERT(acl_connection_ != nullptr); ASSERT(scheduler_ != nullptr); ASSERT(parameter_provider_ != nullptr); acl_connection_->RegisterDisconnectCallback(common::BindOnce(&Link::OnAclDisconnected, common::Unretained(this)), l2cap_handler_); link_idle_disconnect_alarm_.Schedule(common::BindOnce(&Link::Disconnect, common::Unretained(this)), parameter_provider_->GetLeLinkIdleDisconnectTimeout()); } Loading
system/gd/l2cap/le/internal/link_manager.cc +4 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,10 @@ void LinkManager::OnLeConnectSuccess(hci::AddressWithType connecting_address_wit ASSERT_LOG(GetLink(connected_address_with_type) == nullptr, "%s is connected twice without disconnection", acl_connection->GetAddress().ToString().c_str()); auto* link_queue_up_end = acl_connection->GetAclQueueEnd(); // Register ACL disconnection callback in LinkManager so that we can clean up link resource properly acl_connection->RegisterDisconnectCallback( common::BindOnce(&LinkManager::OnDisconnect, common::Unretained(this), connected_address_with_type), l2cap_handler_); links_.try_emplace(connected_address_with_type, l2cap_handler_, std::move(acl_connection), std::make_unique<l2cap::internal::Fifo>(link_queue_up_end, l2cap_handler_), parameter_provider_); auto* link = GetLink(connected_address_with_type); Loading