Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/wrong order of requests on device disconnect #2517

Merged
merged 2 commits into from
May 19, 2020

Conversation

KVGrygoriev
Copy link
Contributor

Fixes #2238

This PR is ready for review.

Risk

This PR makes no API changes.

Summary

Moves clearing command list and SendOnAppUnreg notification call into separate logic unit.
Fixes SDL behaviour when device is suddenly disconnected.

CLA

@KVGrygoriev KVGrygoriev changed the base branch from master to develop August 16, 2018 16:40
@@ -1440,6 +1440,14 @@ class ApplicationManagerImpl
static std::vector<std::string> ConvertRejectedParamList(
const std::vector<std::string>& input);

/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KVGrygoriev missed arg names in description
@param app_to_remove the application which should be removed
@param is_unexpected_disconnect specifies whether the disconnect was unexpected

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@EKuliiev thanks, fixed

@KVGrygoriev KVGrygoriev force-pushed the fix/wrong_order_of_requests_on_device_disconnect branch from 3753dbf to 0899fa0 Compare August 17, 2018 12:32
@@ -2623,12 +2630,15 @@ void ApplicationManagerImpl::UnregisterApplication(
logger_, "There is no more SDL4 apps with device handle: " << handle);

RemoveAppsWaitingForRegistration(handle);
ClearCommandListAndSendOnAppUnregNotificationToHMI(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KVGrygoriev I really dont like functions with more than one responsibility.
I suggest you to update this code like:

if (!app) { 
  LOG4CXX_DEBUG( 
       logger_, "There is no more SDL4 apps with device handle: " << handle); 
       RemoveAppsWaitingForRegistration(handle); 
}

commands_holder_->Clear(app_to_remove); 
MessageHelper::SendOnAppUnregNotificationToHMI(app_to_remove, is_unexpected_disconnect, *this);  

if (!app) { 
	SendUpdateAppList(); 
}

Or even like this if SendUpdateAppList call order is not necessary for this case:

if (!app) { 
  LOG4CXX_DEBUG( 
       logger_, "There is no more SDL4 apps with device handle: " << handle); 
       RemoveAppsWaitingForRegistration(handle); 
       SendUpdateAppList(); 
}

commands_holder_->Clear(app_to_remove); 
MessageHelper::SendOnAppUnregNotificationToHMI(app_to_remove, is_unexpected_disconnect, *this);  

@KVGrygoriev KVGrygoriev force-pushed the fix/wrong_order_of_requests_on_device_disconnect branch from 14f3b8c to 34440c0 Compare August 20, 2018 10:16
@KVGrygoriev
Copy link
Contributor Author

@AKalinich-Luxoft fixed

@KVGrygoriev KVGrygoriev force-pushed the fix/wrong_order_of_requests_on_device_disconnect branch from 34440c0 to b5dccbb Compare August 20, 2018 14:19
@KVGrygoriev KVGrygoriev force-pushed the fix/wrong_order_of_requests_on_device_disconnect branch from b5dccbb to 5b95373 Compare August 20, 2018 15:53
@@ -1949,7 +1949,7 @@ bool ApplicationManagerImpl::Stop() {
application_list_update_timer_.Stop();
try {
SetUnregisterAllApplicationsReason(
mobile_api::AppInterfaceUnregisteredReason::IGNITION_OFF);
mobile_api::AppInterfaceUnregisteredReason::IGNITION_OFF);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KVGrygoriev make this change as additional commit

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LuxoftAKutsan this changes will disappear when someone fix it in develop branch

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KVGrygoriev commit will still contain this changes and cherry pick may trigger conflicts

@iCollin iCollin merged commit bb4a6fb into develop May 19, 2020
@iCollin iCollin deleted the fix/wrong_order_of_requests_on_device_disconnect branch May 19, 2020 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants