From d61c90e06dd8c8fce207c10ca455b97d111e67cd Mon Sep 17 00:00:00 2001 From: Chris Manton Date: Fri, 8 Nov 2019 15:06:56 -0800 Subject: [PATCH] Minor clean up detail for signalling Bug: 143697964 Test: bluetooth_test_gd Change-Id: I869ffeb75b407be03385270d597c7d02d0eebb09 --- gd/l2cap/classic/internal/signalling_manager.cc | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/gd/l2cap/classic/internal/signalling_manager.cc b/gd/l2cap/classic/internal/signalling_manager.cc index 7ba61a7eb..d3a9e62b2 100644 --- a/gd/l2cap/classic/internal/signalling_manager.cc +++ b/gd/l2cap/classic/internal/signalling_manager.cc @@ -178,8 +178,8 @@ void ClassicSignallingManager::OnConnectionResponse(SignalId signal_id, Cid remo handle_send_next_command(); return; } - SendConfigurationRequest(remote_cid, {}); alarm_.Cancel(); + SendConfigurationRequest(remote_cid, {}); handle_send_next_command(); } @@ -190,13 +190,12 @@ void ClassicSignallingManager::OnConfigurationRequest(SignalId signal_id, Cid ci LOG_WARN("Configuration request for an unknown channel"); return; } - auto response = ConfigurationResponseBuilder::Create(signal_id.Value(), cid, is_continuation, + auto response = ConfigurationResponseBuilder::Create(signal_id.Value(), channel->GetRemoteCid(), is_continuation, ConfigurationResponseResult::SUCCESS, {}); enqueue_buffer_->Enqueue(std::move(response), handler_); handle_send_next_command(); channel->SetIncomingConfigurationStatus(DynamicChannelImpl::ConfigurationStatus::CONFIGURED); if (channel->GetOutgoingConfigurationStatus() == DynamicChannelImpl::ConfigurationStatus::CONFIGURED) { - LOG_INFO(); std::unique_ptr user_channel = std::make_unique(channel, handler_); dynamic_service_manager_->GetService(channel->GetPsm())->NotifyChannelCreation(std::move(user_channel)); } @@ -213,21 +212,19 @@ void ClassicSignallingManager::OnConfigurationResponse(SignalId signal_id, Cid c auto last_sent_command = std::move(pending_commands_.front()); pending_commands_.pop(); - auto channel = channel_allocator_->FindChannelByRemoteCid(cid); + auto channel = channel_allocator_->FindChannelByCid(cid); if (channel == nullptr) { LOG_WARN("Configuration request for an unknown channel"); handle_send_next_command(); return; } - // TODO(cmanton) verify configuration parameters are satisfied - // TODO(cmanton) Indicate channel is open if config params are agreed upon - handle_send_next_command(); channel->SetOutgoingConfigurationStatus(DynamicChannelImpl::ConfigurationStatus::CONFIGURED); if (channel->GetIncomingConfigurationStatus() == DynamicChannelImpl::ConfigurationStatus::CONFIGURED) { std::unique_ptr user_channel = std::make_unique(channel, handler_); dynamic_service_manager_->GetService(channel->GetPsm())->NotifyChannelCreation(std::move(user_channel)); } alarm_.Cancel(); + handle_send_next_command(); } void ClassicSignallingManager::OnDisconnectionRequest(SignalId signal_id, Cid cid, Cid remote_cid) { @@ -244,13 +241,14 @@ void ClassicSignallingManager::OnDisconnectionRequest(SignalId signal_id, Cid ci handle_send_next_command(); } -void ClassicSignallingManager::OnDisconnectionResponse(SignalId signal_id, Cid cid, Cid remote_cid) { +void ClassicSignallingManager::OnDisconnectionResponse(SignalId signal_id, Cid remote_cid, Cid cid) { if (pending_commands_.empty()) { LOG_WARN("Unexpected response: no pending request"); return; } auto last_sent_command = std::move(pending_commands_.front()); pending_commands_.pop(); + alarm_.Cancel(); if (last_sent_command.signal_id_ != signal_id || last_sent_command.command_code_ != CommandCode::DISCONNECTION_REQUEST) { @@ -267,7 +265,6 @@ void ClassicSignallingManager::OnDisconnectionResponse(SignalId signal_id, Cid c channel->OnClosed(hci::ErrorCode::SUCCESS); link_->FreeDynamicChannel(cid); handle_send_next_command(); - alarm_.Cancel(); } void ClassicSignallingManager::OnEchoRequest(SignalId signal_id, const PacketView& packet) { @@ -291,8 +288,8 @@ void ClassicSignallingManager::OnEchoResponse(SignalId signal_id, const PacketVi return; } LOG_INFO("Echo response received"); - handle_send_next_command(); alarm_.Cancel(); + handle_send_next_command(); } void ClassicSignallingManager::OnInformationRequest(SignalId signal_id, InformationRequestInfoType type) { @@ -332,8 +329,8 @@ void ClassicSignallingManager::OnInformationResponse(SignalId signal_id, const I return; } // TODO (hsz): Store the information response - handle_send_next_command(); alarm_.Cancel(); + handle_send_next_command(); } void ClassicSignallingManager::on_incoming_packet() { -- 2.11.0