Loading system/gd/l2cap/classic/dynamic_channel_manager.h +1 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ class DynamicChannelManager { FAIL_HCI_ERROR = 2, // See hci_error FAIL_L2CAP_ERROR = 3, // See l2cap_connection_response_result FAIL_REMOTE_NOT_SUPPORT = 4, // Remote not support required retansmission and flow control mode FAIL_SECURITY_BLOCK = 5, // Cannot enhance required security level }; struct ConnectionResult { Loading system/gd/l2cap/classic/internal/link.cc +1 −6 Original line number Diff line number Diff line Loading @@ -178,14 +178,9 @@ void Link::send_pending_configuration_requests() { pending_outgoing_configuration_request_list_.clear(); } void Link::OnOutgoingConnectionRequestFail(Cid local_cid) { void Link::OnOutgoingConnectionRequestFail(Cid local_cid, ConnectionResult result) { if (local_cid_to_pending_dynamic_channel_connection_map_.find(local_cid) != local_cid_to_pending_dynamic_channel_connection_map_.end()) { ConnectionResult result{ .connection_result_code = ConnectionResultCode::FAIL_HCI_ERROR, .hci_error = hci::ErrorCode::CONNECTION_TIMEOUT, .l2cap_connection_response_result = ConnectionResponseResult::SUCCESS, }; NotifyChannelFail(local_cid, result); } dynamic_channel_allocator_.FreeChannel(local_cid); Loading system/gd/l2cap/classic/internal/link.h +1 −1 Original line number Diff line number Diff line Loading @@ -111,7 +111,7 @@ class Link : public l2cap::internal::ILink, public hci::acl_manager::ConnectionM std::list<Link::PendingDynamicChannelConnection> callback_list); // Invoked by signalling manager to indicate an outgoing connection request failed and link shall free resources virtual void OnOutgoingConnectionRequestFail(Cid local_cid); virtual void OnOutgoingConnectionRequestFail(Cid local_cid, DynamicChannelManager::ConnectionResult result); virtual void SendInitialConfigRequestOrQueue(Cid local_cid); Loading system/gd/l2cap/classic/internal/signalling_manager.cc +30 −3 Original line number Diff line number Diff line Loading @@ -107,6 +107,12 @@ void ClassicSignallingManager::on_security_result_for_outgoing(Psm psm, bool res if (!result) { LOG_WARN("Security requirement can't be satisfied. Dropping connection request"); DynamicChannelManager::ConnectionResult connection_result{ .connection_result_code = DynamicChannelManager::ConnectionResultCode::FAIL_SECURITY_BLOCK, .hci_error = hci::ErrorCode::SUCCESS, .l2cap_connection_response_result = ConnectionResponseResult::NO_RESOURCES_AVAILABLE, }; link_->OnOutgoingConnectionRequestFail(request.local_cid, connection_result); return; } Loading Loading @@ -205,6 +211,12 @@ void ClassicSignallingManager::on_security_result_for_incoming(Psm psm, bool res if (!result) { send_connection_response(signal_id, request.remote_cid, request.local_cid, ConnectionResponseResult::SECURITY_BLOCK, ConnectionResponseStatus::NO_FURTHER_INFORMATION_AVAILABLE); DynamicChannelManager::ConnectionResult connection_result{ .connection_result_code = DynamicChannelManager::ConnectionResultCode::FAIL_SECURITY_BLOCK, .hci_error = hci::ErrorCode::SUCCESS, .l2cap_connection_response_result = ConnectionResponseResult::NO_RESOURCES_AVAILABLE, }; link_->OnOutgoingConnectionRequestFail(request.local_cid, connection_result); } auto new_channel = link_->AllocateDynamicChannel(psm, request.remote_cid); Loading Loading @@ -241,7 +253,12 @@ void ClassicSignallingManager::OnConnectionResponse(SignalId signal_id, Cid remo command_just_sent_.signal_id_ = kInvalidSignalId; alarm_.Cancel(); if (result != ConnectionResponseResult::SUCCESS) { link_->OnOutgoingConnectionRequestFail(cid); DynamicChannelManager::ConnectionResult connection_result{ .connection_result_code = DynamicChannelManager::ConnectionResultCode::FAIL_L2CAP_ERROR, .hci_error = hci::ErrorCode::SUCCESS, .l2cap_connection_response_result = result, }; link_->OnOutgoingConnectionRequestFail(cid, connection_result); handle_send_next_command(); return; } Loading @@ -249,7 +266,12 @@ void ClassicSignallingManager::OnConnectionResponse(SignalId signal_id, Cid remo auto new_channel = link_->AllocateReservedDynamicChannel(cid, pending_psm, remote_cid); if (new_channel == nullptr) { LOG_WARN("Can't allocate dynamic channel"); link_->OnOutgoingConnectionRequestFail(cid); DynamicChannelManager::ConnectionResult connection_result{ .connection_result_code = DynamicChannelManager::ConnectionResultCode::FAIL_L2CAP_ERROR, .hci_error = hci::ErrorCode::SUCCESS, .l2cap_connection_response_result = ConnectionResponseResult::NO_RESOURCES_AVAILABLE, }; link_->OnOutgoingConnectionRequestFail(cid, connection_result); handle_send_next_command(); return; } Loading Loading @@ -828,7 +850,12 @@ void ClassicSignallingManager::on_command_timeout() { LOG_WARN("Response time out for %s", CommandCodeText(command_just_sent_.command_code_).c_str()); switch (command_just_sent_.command_code_) { case CommandCode::CONNECTION_REQUEST: { link_->OnOutgoingConnectionRequestFail(command_just_sent_.source_cid_); DynamicChannelManager::ConnectionResult connection_result{ .connection_result_code = DynamicChannelManager::ConnectionResultCode::FAIL_L2CAP_ERROR, .hci_error = hci::ErrorCode::SUCCESS, .l2cap_connection_response_result = ConnectionResponseResult::NO_RESOURCES_AVAILABLE, }; link_->OnOutgoingConnectionRequestFail(command_just_sent_.source_cid_, connection_result); break; } case CommandCode::CONFIGURATION_REQUEST: { Loading system/gd/shim/l2cap.cc +3 −0 Original line number Diff line number Diff line Loading @@ -361,6 +361,9 @@ class PendingConnection { case l2cap::classic::DynamicChannelManager::ConnectionResultCode::FAIL_REMOTE_NOT_SUPPORT: LOG_DEBUG("Connection failed result:Remote not support required retransmission and flow control mode"); break; case l2cap::classic::DynamicChannelManager::ConnectionResultCode::FAIL_SECURITY_BLOCK: LOG_DEBUG("Connection failed result:security block"); break; } pending_fail_(result); } Loading Loading
system/gd/l2cap/classic/dynamic_channel_manager.h +1 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ class DynamicChannelManager { FAIL_HCI_ERROR = 2, // See hci_error FAIL_L2CAP_ERROR = 3, // See l2cap_connection_response_result FAIL_REMOTE_NOT_SUPPORT = 4, // Remote not support required retansmission and flow control mode FAIL_SECURITY_BLOCK = 5, // Cannot enhance required security level }; struct ConnectionResult { Loading
system/gd/l2cap/classic/internal/link.cc +1 −6 Original line number Diff line number Diff line Loading @@ -178,14 +178,9 @@ void Link::send_pending_configuration_requests() { pending_outgoing_configuration_request_list_.clear(); } void Link::OnOutgoingConnectionRequestFail(Cid local_cid) { void Link::OnOutgoingConnectionRequestFail(Cid local_cid, ConnectionResult result) { if (local_cid_to_pending_dynamic_channel_connection_map_.find(local_cid) != local_cid_to_pending_dynamic_channel_connection_map_.end()) { ConnectionResult result{ .connection_result_code = ConnectionResultCode::FAIL_HCI_ERROR, .hci_error = hci::ErrorCode::CONNECTION_TIMEOUT, .l2cap_connection_response_result = ConnectionResponseResult::SUCCESS, }; NotifyChannelFail(local_cid, result); } dynamic_channel_allocator_.FreeChannel(local_cid); Loading
system/gd/l2cap/classic/internal/link.h +1 −1 Original line number Diff line number Diff line Loading @@ -111,7 +111,7 @@ class Link : public l2cap::internal::ILink, public hci::acl_manager::ConnectionM std::list<Link::PendingDynamicChannelConnection> callback_list); // Invoked by signalling manager to indicate an outgoing connection request failed and link shall free resources virtual void OnOutgoingConnectionRequestFail(Cid local_cid); virtual void OnOutgoingConnectionRequestFail(Cid local_cid, DynamicChannelManager::ConnectionResult result); virtual void SendInitialConfigRequestOrQueue(Cid local_cid); Loading
system/gd/l2cap/classic/internal/signalling_manager.cc +30 −3 Original line number Diff line number Diff line Loading @@ -107,6 +107,12 @@ void ClassicSignallingManager::on_security_result_for_outgoing(Psm psm, bool res if (!result) { LOG_WARN("Security requirement can't be satisfied. Dropping connection request"); DynamicChannelManager::ConnectionResult connection_result{ .connection_result_code = DynamicChannelManager::ConnectionResultCode::FAIL_SECURITY_BLOCK, .hci_error = hci::ErrorCode::SUCCESS, .l2cap_connection_response_result = ConnectionResponseResult::NO_RESOURCES_AVAILABLE, }; link_->OnOutgoingConnectionRequestFail(request.local_cid, connection_result); return; } Loading Loading @@ -205,6 +211,12 @@ void ClassicSignallingManager::on_security_result_for_incoming(Psm psm, bool res if (!result) { send_connection_response(signal_id, request.remote_cid, request.local_cid, ConnectionResponseResult::SECURITY_BLOCK, ConnectionResponseStatus::NO_FURTHER_INFORMATION_AVAILABLE); DynamicChannelManager::ConnectionResult connection_result{ .connection_result_code = DynamicChannelManager::ConnectionResultCode::FAIL_SECURITY_BLOCK, .hci_error = hci::ErrorCode::SUCCESS, .l2cap_connection_response_result = ConnectionResponseResult::NO_RESOURCES_AVAILABLE, }; link_->OnOutgoingConnectionRequestFail(request.local_cid, connection_result); } auto new_channel = link_->AllocateDynamicChannel(psm, request.remote_cid); Loading Loading @@ -241,7 +253,12 @@ void ClassicSignallingManager::OnConnectionResponse(SignalId signal_id, Cid remo command_just_sent_.signal_id_ = kInvalidSignalId; alarm_.Cancel(); if (result != ConnectionResponseResult::SUCCESS) { link_->OnOutgoingConnectionRequestFail(cid); DynamicChannelManager::ConnectionResult connection_result{ .connection_result_code = DynamicChannelManager::ConnectionResultCode::FAIL_L2CAP_ERROR, .hci_error = hci::ErrorCode::SUCCESS, .l2cap_connection_response_result = result, }; link_->OnOutgoingConnectionRequestFail(cid, connection_result); handle_send_next_command(); return; } Loading @@ -249,7 +266,12 @@ void ClassicSignallingManager::OnConnectionResponse(SignalId signal_id, Cid remo auto new_channel = link_->AllocateReservedDynamicChannel(cid, pending_psm, remote_cid); if (new_channel == nullptr) { LOG_WARN("Can't allocate dynamic channel"); link_->OnOutgoingConnectionRequestFail(cid); DynamicChannelManager::ConnectionResult connection_result{ .connection_result_code = DynamicChannelManager::ConnectionResultCode::FAIL_L2CAP_ERROR, .hci_error = hci::ErrorCode::SUCCESS, .l2cap_connection_response_result = ConnectionResponseResult::NO_RESOURCES_AVAILABLE, }; link_->OnOutgoingConnectionRequestFail(cid, connection_result); handle_send_next_command(); return; } Loading Loading @@ -828,7 +850,12 @@ void ClassicSignallingManager::on_command_timeout() { LOG_WARN("Response time out for %s", CommandCodeText(command_just_sent_.command_code_).c_str()); switch (command_just_sent_.command_code_) { case CommandCode::CONNECTION_REQUEST: { link_->OnOutgoingConnectionRequestFail(command_just_sent_.source_cid_); DynamicChannelManager::ConnectionResult connection_result{ .connection_result_code = DynamicChannelManager::ConnectionResultCode::FAIL_L2CAP_ERROR, .hci_error = hci::ErrorCode::SUCCESS, .l2cap_connection_response_result = ConnectionResponseResult::NO_RESOURCES_AVAILABLE, }; link_->OnOutgoingConnectionRequestFail(command_just_sent_.source_cid_, connection_result); break; } case CommandCode::CONFIGURATION_REQUEST: { Loading
system/gd/shim/l2cap.cc +3 −0 Original line number Diff line number Diff line Loading @@ -361,6 +361,9 @@ class PendingConnection { case l2cap::classic::DynamicChannelManager::ConnectionResultCode::FAIL_REMOTE_NOT_SUPPORT: LOG_DEBUG("Connection failed result:Remote not support required retransmission and flow control mode"); break; case l2cap::classic::DynamicChannelManager::ConnectionResultCode::FAIL_SECURITY_BLOCK: LOG_DEBUG("Connection failed result:security block"); break; } pending_fail_(result); } Loading