From ff498abb5b0ee30a68d89bb9696a1254eb05102d Mon Sep 17 00:00:00 2001 From: sniukalov Date: Fri, 7 Feb 2020 19:18:42 +0200 Subject: Update functionality --- .../policy/policy_external/include/policy/update_status_manager.h | 1 + src/components/policy/policy_external/src/policy_manager_impl.cc | 1 + src/components/policy/policy_external/src/status.cc | 3 --- .../policy/policy_external/src/update_status_manager.cc | 8 +++++++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/policy/policy_external/include/policy/update_status_manager.h b/src/components/policy/policy_external/include/policy/update_status_manager.h index 2ca19a4d67..018bab7f99 100644 --- a/src/components/policy/policy_external/include/policy/update_status_manager.h +++ b/src/components/policy/policy_external/include/policy/update_status_manager.h @@ -228,6 +228,7 @@ class UpdateStatusManager { UpdateEvent last_processed_event_; bool apps_search_in_progress_; bool app_registered_from_non_consented_device_; + bool last_update_was_failed_; sync_primitives::Lock apps_search_in_progress_lock_; class UpdateThreadDelegate : public threads::ThreadDelegate { diff --git a/src/components/policy/policy_external/src/policy_manager_impl.cc b/src/components/policy/policy_external/src/policy_manager_impl.cc index d241ca4a39..25a401109f 100644 --- a/src/components/policy/policy_external/src/policy_manager_impl.cc +++ b/src/components/policy/policy_external/src/policy_manager_impl.cc @@ -1401,6 +1401,7 @@ void PolicyManagerImpl::RetrySequenceFailed() { StartPTExchange(); } is_ptu_in_progress_ = false; + ptu_requested_ = false; } void PolicyManagerImpl::ResetTimeout() { diff --git a/src/components/policy/policy_external/src/status.cc b/src/components/policy/policy_external/src/status.cc index 12772c47ce..af7958a3dd 100644 --- a/src/components/policy/policy_external/src/status.cc +++ b/src/components/policy/policy_external/src/status.cc @@ -124,9 +124,6 @@ void policy::UpdatingStatus::ProcessEvent(policy::UpdateStatusManager* manager, case kOnResetPolicyTableNoUpdate: manager->SetNextStatus(std::make_shared()); break; - case kOnNewAppRegistered: - manager->SetPostponedStatus(std::make_shared()); - break; case kOnWrongUpdateReceived: case kOnUpdateTimeout: manager->SetNextStatus(std::make_shared()); diff --git a/src/components/policy/policy_external/src/update_status_manager.cc b/src/components/policy/policy_external/src/update_status_manager.cc index fc6e93f3b7..ccf8b6510c 100644 --- a/src/components/policy/policy_external/src/update_status_manager.cc +++ b/src/components/policy/policy_external/src/update_status_manager.cc @@ -44,7 +44,8 @@ UpdateStatusManager::UpdateStatusManager() , current_status_(std::make_shared()) , last_processed_event_(kNoEvent) , apps_search_in_progress_(false) - , app_registered_from_non_consented_device_(true) { + , app_registered_from_non_consented_device_(true) + , last_update_was_failed_(false) { update_status_thread_delegate_ = new UpdateThreadDelegate(this); thread_ = threads::CreateThread("UpdateStatusThread", update_status_thread_delegate_); @@ -136,6 +137,7 @@ void UpdateStatusManager::OnResetDefaultPT(bool is_update_required) { void UpdateStatusManager::OnResetRetrySequence() { LOG4CXX_AUTO_TRACE(logger_); + last_update_was_failed_ = true; ProcessEvent(kOnResetRetrySequence); } @@ -157,6 +159,10 @@ void UpdateStatusManager::OnNewApplicationAdded(const DeviceConsent consent) { } LOG4CXX_DEBUG(logger_, "Application registered from consented device"); app_registered_from_non_consented_device_ = false; + if (last_update_was_failed_) { + last_update_was_failed_ = false; + ProcessEvent(kUpdateForNextInQueue); + } ProcessEvent(kOnNewAppRegistered); } -- cgit v1.2.1