Loading system/gd/l2cap/classic/internal/signalling_manager.cc +8 −11 Original line number Original line Diff line number Diff line Loading @@ -178,8 +178,8 @@ void ClassicSignallingManager::OnConnectionResponse(SignalId signal_id, Cid remo handle_send_next_command(); handle_send_next_command(); return; return; } } SendConfigurationRequest(remote_cid, {}); alarm_.Cancel(); alarm_.Cancel(); SendConfigurationRequest(remote_cid, {}); handle_send_next_command(); handle_send_next_command(); } } Loading @@ -190,13 +190,12 @@ void ClassicSignallingManager::OnConfigurationRequest(SignalId signal_id, Cid ci LOG_WARN("Configuration request for an unknown channel"); LOG_WARN("Configuration request for an unknown channel"); return; return; } } auto response = ConfigurationResponseBuilder::Create(signal_id.Value(), cid, is_continuation, auto response = ConfigurationResponseBuilder::Create(signal_id.Value(), channel->GetRemoteCid(), is_continuation, ConfigurationResponseResult::SUCCESS, {}); ConfigurationResponseResult::SUCCESS, {}); enqueue_buffer_->Enqueue(std::move(response), handler_); enqueue_buffer_->Enqueue(std::move(response), handler_); handle_send_next_command(); handle_send_next_command(); channel->SetIncomingConfigurationStatus(DynamicChannelImpl::ConfigurationStatus::CONFIGURED); channel->SetIncomingConfigurationStatus(DynamicChannelImpl::ConfigurationStatus::CONFIGURED); if (channel->GetOutgoingConfigurationStatus() == DynamicChannelImpl::ConfigurationStatus::CONFIGURED) { if (channel->GetOutgoingConfigurationStatus() == DynamicChannelImpl::ConfigurationStatus::CONFIGURED) { LOG_INFO(); std::unique_ptr<DynamicChannel> user_channel = std::make_unique<DynamicChannel>(channel, handler_); std::unique_ptr<DynamicChannel> user_channel = std::make_unique<DynamicChannel>(channel, handler_); dynamic_service_manager_->GetService(channel->GetPsm())->NotifyChannelCreation(std::move(user_channel)); dynamic_service_manager_->GetService(channel->GetPsm())->NotifyChannelCreation(std::move(user_channel)); } } Loading @@ -213,21 +212,19 @@ void ClassicSignallingManager::OnConfigurationResponse(SignalId signal_id, Cid c auto last_sent_command = std::move(pending_commands_.front()); auto last_sent_command = std::move(pending_commands_.front()); pending_commands_.pop(); pending_commands_.pop(); auto channel = channel_allocator_->FindChannelByRemoteCid(cid); auto channel = channel_allocator_->FindChannelByCid(cid); if (channel == nullptr) { if (channel == nullptr) { LOG_WARN("Configuration request for an unknown channel"); LOG_WARN("Configuration request for an unknown channel"); handle_send_next_command(); handle_send_next_command(); return; 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); channel->SetOutgoingConfigurationStatus(DynamicChannelImpl::ConfigurationStatus::CONFIGURED); if (channel->GetIncomingConfigurationStatus() == DynamicChannelImpl::ConfigurationStatus::CONFIGURED) { if (channel->GetIncomingConfigurationStatus() == DynamicChannelImpl::ConfigurationStatus::CONFIGURED) { std::unique_ptr<DynamicChannel> user_channel = std::make_unique<DynamicChannel>(channel, handler_); std::unique_ptr<DynamicChannel> user_channel = std::make_unique<DynamicChannel>(channel, handler_); dynamic_service_manager_->GetService(channel->GetPsm())->NotifyChannelCreation(std::move(user_channel)); dynamic_service_manager_->GetService(channel->GetPsm())->NotifyChannelCreation(std::move(user_channel)); } } alarm_.Cancel(); alarm_.Cancel(); handle_send_next_command(); } } void ClassicSignallingManager::OnDisconnectionRequest(SignalId signal_id, Cid cid, Cid remote_cid) { void ClassicSignallingManager::OnDisconnectionRequest(SignalId signal_id, Cid cid, Cid remote_cid) { Loading @@ -244,13 +241,14 @@ void ClassicSignallingManager::OnDisconnectionRequest(SignalId signal_id, Cid ci handle_send_next_command(); 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()) { if (pending_commands_.empty()) { LOG_WARN("Unexpected response: no pending request"); LOG_WARN("Unexpected response: no pending request"); return; return; } } auto last_sent_command = std::move(pending_commands_.front()); auto last_sent_command = std::move(pending_commands_.front()); pending_commands_.pop(); pending_commands_.pop(); alarm_.Cancel(); if (last_sent_command.signal_id_ != signal_id || if (last_sent_command.signal_id_ != signal_id || last_sent_command.command_code_ != CommandCode::DISCONNECTION_REQUEST) { last_sent_command.command_code_ != CommandCode::DISCONNECTION_REQUEST) { Loading @@ -267,7 +265,6 @@ void ClassicSignallingManager::OnDisconnectionResponse(SignalId signal_id, Cid c channel->OnClosed(hci::ErrorCode::SUCCESS); channel->OnClosed(hci::ErrorCode::SUCCESS); link_->FreeDynamicChannel(cid); link_->FreeDynamicChannel(cid); handle_send_next_command(); handle_send_next_command(); alarm_.Cancel(); } } void ClassicSignallingManager::OnEchoRequest(SignalId signal_id, const PacketView<kLittleEndian>& packet) { void ClassicSignallingManager::OnEchoRequest(SignalId signal_id, const PacketView<kLittleEndian>& packet) { Loading @@ -291,8 +288,8 @@ void ClassicSignallingManager::OnEchoResponse(SignalId signal_id, const PacketVi return; return; } } LOG_INFO("Echo response received"); LOG_INFO("Echo response received"); handle_send_next_command(); alarm_.Cancel(); alarm_.Cancel(); handle_send_next_command(); } } void ClassicSignallingManager::OnInformationRequest(SignalId signal_id, InformationRequestInfoType type) { void ClassicSignallingManager::OnInformationRequest(SignalId signal_id, InformationRequestInfoType type) { Loading Loading @@ -332,8 +329,8 @@ void ClassicSignallingManager::OnInformationResponse(SignalId signal_id, const I return; return; } } // TODO (hsz): Store the information response // TODO (hsz): Store the information response handle_send_next_command(); alarm_.Cancel(); alarm_.Cancel(); handle_send_next_command(); } } void ClassicSignallingManager::on_incoming_packet() { void ClassicSignallingManager::on_incoming_packet() { Loading Loading
system/gd/l2cap/classic/internal/signalling_manager.cc +8 −11 Original line number Original line Diff line number Diff line Loading @@ -178,8 +178,8 @@ void ClassicSignallingManager::OnConnectionResponse(SignalId signal_id, Cid remo handle_send_next_command(); handle_send_next_command(); return; return; } } SendConfigurationRequest(remote_cid, {}); alarm_.Cancel(); alarm_.Cancel(); SendConfigurationRequest(remote_cid, {}); handle_send_next_command(); handle_send_next_command(); } } Loading @@ -190,13 +190,12 @@ void ClassicSignallingManager::OnConfigurationRequest(SignalId signal_id, Cid ci LOG_WARN("Configuration request for an unknown channel"); LOG_WARN("Configuration request for an unknown channel"); return; return; } } auto response = ConfigurationResponseBuilder::Create(signal_id.Value(), cid, is_continuation, auto response = ConfigurationResponseBuilder::Create(signal_id.Value(), channel->GetRemoteCid(), is_continuation, ConfigurationResponseResult::SUCCESS, {}); ConfigurationResponseResult::SUCCESS, {}); enqueue_buffer_->Enqueue(std::move(response), handler_); enqueue_buffer_->Enqueue(std::move(response), handler_); handle_send_next_command(); handle_send_next_command(); channel->SetIncomingConfigurationStatus(DynamicChannelImpl::ConfigurationStatus::CONFIGURED); channel->SetIncomingConfigurationStatus(DynamicChannelImpl::ConfigurationStatus::CONFIGURED); if (channel->GetOutgoingConfigurationStatus() == DynamicChannelImpl::ConfigurationStatus::CONFIGURED) { if (channel->GetOutgoingConfigurationStatus() == DynamicChannelImpl::ConfigurationStatus::CONFIGURED) { LOG_INFO(); std::unique_ptr<DynamicChannel> user_channel = std::make_unique<DynamicChannel>(channel, handler_); std::unique_ptr<DynamicChannel> user_channel = std::make_unique<DynamicChannel>(channel, handler_); dynamic_service_manager_->GetService(channel->GetPsm())->NotifyChannelCreation(std::move(user_channel)); dynamic_service_manager_->GetService(channel->GetPsm())->NotifyChannelCreation(std::move(user_channel)); } } Loading @@ -213,21 +212,19 @@ void ClassicSignallingManager::OnConfigurationResponse(SignalId signal_id, Cid c auto last_sent_command = std::move(pending_commands_.front()); auto last_sent_command = std::move(pending_commands_.front()); pending_commands_.pop(); pending_commands_.pop(); auto channel = channel_allocator_->FindChannelByRemoteCid(cid); auto channel = channel_allocator_->FindChannelByCid(cid); if (channel == nullptr) { if (channel == nullptr) { LOG_WARN("Configuration request for an unknown channel"); LOG_WARN("Configuration request for an unknown channel"); handle_send_next_command(); handle_send_next_command(); return; 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); channel->SetOutgoingConfigurationStatus(DynamicChannelImpl::ConfigurationStatus::CONFIGURED); if (channel->GetIncomingConfigurationStatus() == DynamicChannelImpl::ConfigurationStatus::CONFIGURED) { if (channel->GetIncomingConfigurationStatus() == DynamicChannelImpl::ConfigurationStatus::CONFIGURED) { std::unique_ptr<DynamicChannel> user_channel = std::make_unique<DynamicChannel>(channel, handler_); std::unique_ptr<DynamicChannel> user_channel = std::make_unique<DynamicChannel>(channel, handler_); dynamic_service_manager_->GetService(channel->GetPsm())->NotifyChannelCreation(std::move(user_channel)); dynamic_service_manager_->GetService(channel->GetPsm())->NotifyChannelCreation(std::move(user_channel)); } } alarm_.Cancel(); alarm_.Cancel(); handle_send_next_command(); } } void ClassicSignallingManager::OnDisconnectionRequest(SignalId signal_id, Cid cid, Cid remote_cid) { void ClassicSignallingManager::OnDisconnectionRequest(SignalId signal_id, Cid cid, Cid remote_cid) { Loading @@ -244,13 +241,14 @@ void ClassicSignallingManager::OnDisconnectionRequest(SignalId signal_id, Cid ci handle_send_next_command(); 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()) { if (pending_commands_.empty()) { LOG_WARN("Unexpected response: no pending request"); LOG_WARN("Unexpected response: no pending request"); return; return; } } auto last_sent_command = std::move(pending_commands_.front()); auto last_sent_command = std::move(pending_commands_.front()); pending_commands_.pop(); pending_commands_.pop(); alarm_.Cancel(); if (last_sent_command.signal_id_ != signal_id || if (last_sent_command.signal_id_ != signal_id || last_sent_command.command_code_ != CommandCode::DISCONNECTION_REQUEST) { last_sent_command.command_code_ != CommandCode::DISCONNECTION_REQUEST) { Loading @@ -267,7 +265,6 @@ void ClassicSignallingManager::OnDisconnectionResponse(SignalId signal_id, Cid c channel->OnClosed(hci::ErrorCode::SUCCESS); channel->OnClosed(hci::ErrorCode::SUCCESS); link_->FreeDynamicChannel(cid); link_->FreeDynamicChannel(cid); handle_send_next_command(); handle_send_next_command(); alarm_.Cancel(); } } void ClassicSignallingManager::OnEchoRequest(SignalId signal_id, const PacketView<kLittleEndian>& packet) { void ClassicSignallingManager::OnEchoRequest(SignalId signal_id, const PacketView<kLittleEndian>& packet) { Loading @@ -291,8 +288,8 @@ void ClassicSignallingManager::OnEchoResponse(SignalId signal_id, const PacketVi return; return; } } LOG_INFO("Echo response received"); LOG_INFO("Echo response received"); handle_send_next_command(); alarm_.Cancel(); alarm_.Cancel(); handle_send_next_command(); } } void ClassicSignallingManager::OnInformationRequest(SignalId signal_id, InformationRequestInfoType type) { void ClassicSignallingManager::OnInformationRequest(SignalId signal_id, InformationRequestInfoType type) { Loading Loading @@ -332,8 +329,8 @@ void ClassicSignallingManager::OnInformationResponse(SignalId signal_id, const I return; return; } } // TODO (hsz): Store the information response // TODO (hsz): Store the information response handle_send_next_command(); alarm_.Cancel(); alarm_.Cancel(); handle_send_next_command(); } } void ClassicSignallingManager::on_incoming_packet() { void ClassicSignallingManager::on_incoming_packet() { Loading