diff options
author | LevchenkoS <slevchenko.work@gmail.com> | 2016-10-13 16:29:36 +0300 |
---|---|---|
committer | LevchenkoS <slevchenko.work@gmail.com> | 2016-10-19 10:05:49 +0300 |
commit | 77439a15f2982391a49f10650a9f0082cf1b7d6c (patch) | |
tree | d2345876b3904d02b95b68712eca9c21bc00fbcc /src/components/application_manager/src/commands/hmi | |
parent | eecb26d8aa2e020208c32c9e301b6dca19c528cc (diff) | |
download | sdl_core-77439a15f2982391a49f10650a9f0082cf1b7d6c.tar.gz |
Fix that StartStreamRequest may hang forever in case of app absence
In `AudioStartStreamRequest`
and `NaviStartStreamRequest`,
subscription to event and
disabling of `AllowedToTerminate`
flag, has been moved after checking
for applications presence.
Closes bug: APPLINK-28988
Diffstat (limited to 'src/components/application_manager/src/commands/hmi')
-rw-r--r-- | src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc | 15 | ||||
-rw-r--r-- | src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc | 16 |
2 files changed, 14 insertions, 17 deletions
diff --git a/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc b/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc index db7477aae2..1e46eab52e 100644 --- a/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc +++ b/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc @@ -63,20 +63,19 @@ void AudioStartStreamRequest::Run() { LOG4CXX_INFO(logger_, "Interface Navi is not supported by system"); return; } - SetAllowedToTerminate(false); - subscribe_on_event(hmi_apis::FunctionID::Navigation_StartAudioStream, - correlation_id()); - ApplicationSharedPtr app = application_manager_.application_by_hmi_app(application_id()); - if (app) { - app->set_audio_streaming_allowed(true); - SendRequest(); - } else { + if (!app) { LOG4CXX_ERROR(logger_, "Applcation with hmi_app_id " << application_id() << " does not exist"); + return; } + SetAllowedToTerminate(false); + subscribe_on_event(hmi_apis::FunctionID::Navigation_StartAudioStream, + correlation_id()); + app->set_audio_streaming_allowed(true); + SendRequest(); } void AudioStartStreamRequest::on_event(const event_engine::Event& event) { diff --git a/src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc b/src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc index 38a38e9329..9f1c4b7902 100644 --- a/src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc +++ b/src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc @@ -63,21 +63,19 @@ void NaviStartStreamRequest::Run() { LOG4CXX_INFO(logger_, "Interface Navi is not supported by system"); return; } - - SetAllowedToTerminate(false); - subscribe_on_event(hmi_apis::FunctionID::Navigation_StartStream, - correlation_id()); - ApplicationSharedPtr app = application_manager_.application_by_hmi_app(application_id()); - if (app) { - app->set_video_streaming_allowed(true); - SendRequest(); - } else { + if (!app) { LOG4CXX_ERROR(logger_, "Applcation with hmi_app_id " << application_id() << "does not exist"); + return; } + SetAllowedToTerminate(false); + subscribe_on_event(hmi_apis::FunctionID::Navigation_StartStream, + correlation_id()); + app->set_video_streaming_allowed(true); + SendRequest(); } void NaviStartStreamRequest::on_event(const event_engine::Event& event) { |