diff options
-rw-r--r-- | src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc index b39e50b222..419f1ca0c5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc @@ -192,7 +192,7 @@ RegisterAppInterfaceRequest::~RegisterAppInterfaceRequest() {} bool RegisterAppInterfaceRequest::Init() { LOG4CXX_AUTO_TRACE(logger_); - return GetDataOnSessionKey(connection_key(), &device_handle_, &device_id_); + return true; } void RegisterAppInterfaceRequest::Run() { @@ -226,6 +226,23 @@ void RegisterAppInterfaceRequest::Run() { return; } + // Cache the original app ID (for legacy behavior) + const auto policy_app_id = + application_manager_.GetCorrectMobileIDFromMessage(message_); + + if (application_manager_.IsApplicationForbidden(connection_key(), + policy_app_id)) { + SendResponse(false, mobile_apis::Result::TOO_MANY_PENDING_REQUESTS); + return; + } + + if (!GetDataOnSessionKey(connection_key(), &device_handle_, &device_id_)) { + SendResponse(false, + mobile_apis::Result::GENERIC_ERROR, + "Could not find a session for your connection key!"); + return; + } + LOG4CXX_DEBUG( logger_, "device_handle: " << device_handle_ << " device_id: " << device_id_); @@ -234,10 +251,6 @@ void RegisterAppInterfaceRequest::Run() { return; } - // Cache the original app ID (for legacy behavior) - const auto policy_app_id = - application_manager_.GetCorrectMobileIDFromMessage(message_); - ApplicationSharedPtr application = application_manager_.application(device_id_, policy_app_id); @@ -267,11 +280,6 @@ void RegisterAppInterfaceRequest::Run() { ::tolower); (*message_)[strings::msg_params][strings::full_app_id] = new_app_id_full; } - if (application_manager_.IsApplicationForbidden(connection_key(), - policy_app_id)) { - SendResponse(false, mobile_apis::Result::TOO_MANY_PENDING_REQUESTS); - return; - } if (IsApplicationWithSameAppIdRegistered()) { SendResponse(false, mobile_apis::Result::DISALLOWED); |