diff options
author | Veronica Veremjova (GitHub) <ninvica@gmail.com> | 2020-12-22 16:47:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-22 09:47:24 -0500 |
commit | 218aee15ea7d37dbca773e09cb391d0d229886d6 (patch) | |
tree | 007a52b3c2892d1e3b560fed06c8435ed5ea6f4a /src/components/policy | |
parent | 8a4bf49140b02b7150e12f6f92e02720efeebfee (diff) | |
download | sdl_core-218aee15ea7d37dbca773e09cb391d0d229886d6.tar.gz |
Fix applying heart_beat_timeout_ms from PreDataConsent (#1551)
* Fix applying heart_beat_timeout_ms from PreDataConsent
After sending SDL.OnAllowSDLFunctionality(allowed = false) application is assigned to PreDataConsent group.
After this HB timeout is set to timeout from PreDataConsent
* Updated logs messages and simplify vars after review
* Update unit tests
* Fix syntax errors after rebase
* fixup! Fix syntax errors after rebase
Co-authored-by: Veronica Veremjova <vveremjova@luxoft.com>
Co-authored-by: Andrii Kalinich <AKalinich@luxoft.com>
Diffstat (limited to 'src/components/policy')
-rw-r--r-- | src/components/policy/policy_external/src/cache_manager.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc index 1b5f668e9a..783a622b2e 100644 --- a/src/components/policy/policy_external/src/cache_manager.cc +++ b/src/components/policy/policy_external/src/cache_manager.cc @@ -356,10 +356,12 @@ bool CacheManager::CanAppKeepContext(const std::string& app_id) const { } uint32_t CacheManager::HeartBeatTimeout(const std::string& app_id) const { + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(0); sync_primitives::AutoLock auto_lock(cache_lock_); uint32_t result = 0; if (!IsApplicationRepresented(app_id)) { + SDL_LOG_WARN("Application " << app_id << " is not represented"); return result; } @@ -369,6 +371,7 @@ uint32_t CacheManager::HeartBeatTimeout(const std::string& app_id) const { result = *(app.heart_beat_timeout_ms); } + SDL_LOG_DEBUG("HB timer for app " << app_id << " is " << result); return result; } @@ -674,6 +677,7 @@ void CacheManager::ProcessUpdate( const policy_table::ApplicationPolicies::const_iterator initial_policy_iter) { using namespace policy; + using rpc::policy_table_interface_base::ApplicationParams; using rpc::policy_table_interface_base::RequestTypes; const RequestTypes& new_request_types = *(initial_policy_iter->second.RequestType); @@ -681,6 +685,14 @@ void CacheManager::ProcessUpdate( const std::string& app_id = initial_policy_iter->first; bool update_request_types = true; + ApplicationParams& params = + pt_->policy_table.app_policies_section.apps[app_id]; + if (kPreDataConsentId == app_id) { + *(params.heart_beat_timeout_ms) = + *(initial_policy_iter->second.heart_beat_timeout_ms); + SDL_LOG_INFO("heart_beat_timeout_ms in predata = " + << *(params.heart_beat_timeout_ms)); + } if (app_id == kDefaultId || app_id == kPreDataConsentId) { if (new_request_types.is_omitted()) { SDL_LOG_INFO("Application " << app_id @@ -2528,6 +2540,10 @@ bool policy::CacheManager::SetIsPredata(const std::string& app_id) { if (IsApplicationRepresented(app_id)) { pt_->policy_table.app_policies_section.apps[app_id].set_to_string( kPreDataConsentId); + + pt_->policy_table.app_policies_section.apps[app_id].heart_beat_timeout_ms = + pt_->policy_table.app_policies_section.apps[kPreDataConsentId] + .heart_beat_timeout_ms; } return true; |