diff options
Diffstat (limited to 'src/components/policy')
3 files changed, 23 insertions, 6 deletions
diff --git a/src/components/policy/policy_external/include/policy/policy_types.h b/src/components/policy/policy_external/include/policy/policy_types.h index 94898b2556..021e837196 100644 --- a/src/components/policy/policy_external/include/policy/policy_types.h +++ b/src/components/policy/policy_external/include/policy/policy_types.h @@ -365,17 +365,20 @@ struct MetaInfo { }; /** - * @brief The index of the application and the index of its URL - * from the Endpoints vector that will be sent on the next - * OnSystemRequest retry sequence + * @brief The index of the application, the index of its URL + * and the policy application id from the Endpoints vector + * that will be sent on the next OnSystemRequest retry sequence */ struct RetrySequenceURL { int app_idx_; int url_idx_; - RetrySequenceURL(int app, int url) : app_idx_(app), url_idx_(url) {} + std::string policy_app_id_; + RetrySequenceURL(int app, int url, const std::string& app_id) + : app_idx_(app), url_idx_(url), policy_app_id_(app_id) {} RetrySequenceURL() { app_idx_ = 0; url_idx_ = 0; + policy_app_id_ = ""; } } 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 3e1b28f5be..ad8ac881bd 100644 --- a/src/components/policy/policy_external/src/policy_manager_impl.cc +++ b/src/components/policy/policy_external/src/policy_manager_impl.cc @@ -1199,6 +1199,7 @@ AppIdURL PolicyManagerImpl::GetNextUpdateUrl(const EndpointUrls& urls) { retry_sequence_url_.url_idx_ = next_app_url.second + 1; retry_sequence_url_.app_idx_ = next_app_url.first; + retry_sequence_url_.policy_app_id_ = urls[next_app_url.first].app_id; return next_app_url; } @@ -1207,8 +1208,14 @@ AppIdURL PolicyManagerImpl::RetrySequenceUrl(const struct RetrySequenceURL& rs, const EndpointUrls& urls) const { uint32_t url_idx = rs.url_idx_; uint32_t app_idx = rs.app_idx_; + const std::string app_id = rs.policy_app_id_; - if (url_idx >= urls[app_idx].url.size()) { + if (urls.size() <= app_idx) { + url_idx = 0; + app_idx = 0; + } else if (urls[app_idx].app_id != app_id) { + url_idx = 0; + } else if (url_idx >= urls[app_idx].url.size()) { url_idx = 0; if (++app_idx >= urls.size()) { app_idx = 0; diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc index 2dc768dda0..926a9c5ab7 100644 --- a/src/components/policy/policy_regular/src/policy_manager_impl.cc +++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc @@ -907,6 +907,7 @@ AppIdURL PolicyManagerImpl::GetNextUpdateUrl(const EndpointUrls& urls) { retry_sequence_url_.url_idx_ = next_app_url.second + 1; retry_sequence_url_.app_idx_ = next_app_url.first; + retry_sequence_url_.policy_app_id_ = urls[next_app_url.first].app_id; return next_app_url; } @@ -915,8 +916,14 @@ AppIdURL PolicyManagerImpl::RetrySequenceUrl(const struct RetrySequenceURL& rs, const EndpointUrls& urls) const { uint32_t url_idx = rs.url_idx_; uint32_t app_idx = rs.app_idx_; + const std::string app_id = rs.policy_app_id_; - if (url_idx >= urls[app_idx].url.size()) { + if (urls.size() <= app_idx) { + url_idx = 0; + app_idx = 0; + } else if (urls[app_idx].app_id != app_id) { + url_idx = 0; + } else if (url_idx >= urls[app_idx].url.size()) { url_idx = 0; if (++app_idx >= urls.size()) { app_idx = 0; |