summaryrefslogtreecommitdiff
path: root/src/components/application_manager/src/request_controller.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/src/request_controller.cc')
-rw-r--r--src/components/application_manager/src/request_controller.cc40
1 files changed, 24 insertions, 16 deletions
diff --git a/src/components/application_manager/src/request_controller.cc b/src/components/application_manager/src/request_controller.cc
index f30ed5fd4f..aa2a3d7c5d 100644
--- a/src/components/application_manager/src/request_controller.cc
+++ b/src/components/application_manager/src/request_controller.cc
@@ -57,7 +57,7 @@ RequestController::RequestController(const RequestControlerSettings& settings)
, settings_(settings) {
LOG4CXX_AUTO_TRACE(logger_);
InitializeThreadpool();
- timer_.Start(0, true);
+ timer_.Start(0, timer::kSingleShot);
}
RequestController::~RequestController() {
@@ -232,37 +232,45 @@ void RequestController::removeNotification(
LOG4CXX_DEBUG(logger_, "Cant find notification");
}
-void RequestController::terminateRequest(const uint32_t& correlation_id,
- const uint32_t& connection_key,
+void RequestController::TerminateRequest(const uint32_t correlation_id,
+ const uint32_t connection_key,
+ const int32_t function_id,
bool force_terminate) {
LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(logger_,
"correlation_id = "
<< correlation_id << " connection_key = " << connection_key
+ << " function_id = " << function_id
<< " force_terminate = " << force_terminate);
RequestInfoPtr request =
waiting_for_response_.Find(connection_key, correlation_id);
- if (request) {
- if (force_terminate || request->request()->AllowedToTerminate()) {
- waiting_for_response_.RemoveRequest(request);
- } else {
- LOG4CXX_WARN(logger_, "Request was not terminated");
- }
- NotifyTimer();
+ if (!request) {
+ LOG4CXX_WARN(logger_, "Request was not found in waiting_for_response");
+ return;
+ }
+ if (request->request()->function_id() != function_id) {
+ LOG4CXX_ERROR(logger_, "Request and response function_id's don't match");
+ return;
+ }
+ if (force_terminate || request->request()->AllowedToTerminate()) {
+ waiting_for_response_.RemoveRequest(request);
} else {
- LOG4CXX_WARN(logger_, "Request not found in waiting_for_response_");
+ LOG4CXX_WARN(logger_, "Request was not terminated");
}
+ NotifyTimer();
}
-void RequestController::OnMobileResponse(const uint32_t& mobile_correlation_id,
- const uint32_t& connection_key) {
+void RequestController::OnMobileResponse(const uint32_t mobile_correlation_id,
+ const uint32_t connection_key,
+ const int32_t function_id) {
LOG4CXX_AUTO_TRACE(logger_);
- terminateRequest(mobile_correlation_id, connection_key);
+ TerminateRequest(mobile_correlation_id, connection_key, function_id);
}
-void RequestController::OnHMIResponse(const uint32_t& correlation_id) {
+void RequestController::OnHMIResponse(const uint32_t correlation_id,
+ const int32_t function_id) {
LOG4CXX_AUTO_TRACE(logger_);
- terminateRequest(correlation_id, RequestInfo::HmiConnectoinKey);
+ TerminateRequest(correlation_id, RequestInfo::HmiConnectoinKey, function_id);
}
void RequestController::terminateWaitingForExecutionAppRequests(