diff options
Diffstat (limited to 'src/components/policy/policy_external/src/policy_manager_impl.cc')
-rw-r--r-- | src/components/policy/policy_external/src/policy_manager_impl.cc | 25 |
1 files changed, 24 insertions, 1 deletions
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 88d810ecc2..fa27c95607 100644 --- a/src/components/policy/policy_external/src/policy_manager_impl.cc +++ b/src/components/policy/policy_external/src/policy_manager_impl.cc @@ -66,7 +66,9 @@ PolicyManagerImpl::PolicyManagerImpl() , cache_(new CacheManager) , retry_sequence_timeout_(60) , retry_sequence_index_(0) - , ignition_check(true) {} + , ignition_check(true) + , retry_sequence_url_(0, 0) { +} PolicyManagerImpl::PolicyManagerImpl(bool in_memory) : PolicyManager() @@ -1190,6 +1192,27 @@ void PolicyManagerImpl::SetDecryptedCertificate( cache_->SetDecryptedCertificate(certificate); } +AppIdURL PolicyManagerImpl::GetNextUpdateUrl(const EndpointUrls& urls) { + LOG4CXX_AUTO_TRACE(logger_); + + AppIdURL next_app_url; + uint32_t url = retry_sequence_url_.url; + uint32_t app = retry_sequence_url_.app; + + if (url >= urls[app].url.size()) { + url = 0; + if (++app >= urls.size()) { + app = 0; + } + } + + next_app_url = std::make_pair(urls[app].app_id, urls[app].url[url]); + retry_sequence_url_.url = url + 1; + retry_sequence_url_.app = app; + + return next_app_url; +} + /** * @brief The CallStatusChange class notify update manager aboun new application */ |