summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAGaliuzov <AGaliuzov@luxoft.com>2016-05-10 12:25:27 +0300
committerAGaliuzov <AGaliuzov@luxoft.com>2016-05-10 12:25:27 +0300
commit0ae880e55c055d0707851c03fae371b0a10b2f10 (patch)
tree1f058f9d8b84c3d7054912ba8bdaa25e7f7e0b1f
parentc9a27af07b941a6c9cf6bf9208999d2c5f994775 (diff)
parente0fda2c1b4c3bbefd7770b153250087ab35fe9b8 (diff)
downloadsdl_core-0ae880e55c055d0707851c03fae371b0a10b2f10.tar.gz
Merge pull request #514 from smartdevicelink/hotfix/generate_snapshot_fix_#461
Rewrite GenerateSnapshot()
-rw-r--r--src/components/policy/src/policy/policy_table/table_struct/validation.cc3
-rw-r--r--src/components/policy/src/policy/src/cache_manager.cc16
2 files changed, 17 insertions, 2 deletions
diff --git a/src/components/policy/src/policy/policy_table/table_struct/validation.cc b/src/components/policy/src/policy/policy_table/table_struct/validation.cc
index be39b8022e..a7656960fa 100644
--- a/src/components/policy/src/policy/policy_table/table_struct/validation.cc
+++ b/src/components/policy/src/policy/policy_table/table_struct/validation.cc
@@ -153,7 +153,8 @@ bool MessageLanguages::Validate() const {
}
bool ConsumerFriendlyMessages::Validate() const {
- if (PT_SNAPSHOT == GetPolicyTableType()) {
+ if (PT_SNAPSHOT == GetPolicyTableType() &&
+ messages.is_initialized()) {
return false;
}
return true;
diff --git a/src/components/policy/src/policy/src/cache_manager.cc b/src/components/policy/src/policy/src/cache_manager.cc
index c6df31f35a..b679f27c15 100644
--- a/src/components/policy/src/policy/src/cache_manager.cc
+++ b/src/components/policy/src/policy/src/cache_manager.cc
@@ -790,8 +790,22 @@ utils::SharedPtr<policy_table::Table>
CacheManager::GenerateSnapshot() {
CACHE_MANAGER_CHECK(snapshot_);
sync_primitives::AutoLock lock(cache_lock_);
+
snapshot_ = new policy_table::Table();
- snapshot_->policy_table = pt_->policy_table;
+
+ //Copy all members of policy table except messages in consumer friendly messages
+ snapshot_->policy_table.app_policies_section = pt_->policy_table.app_policies_section;
+ snapshot_->policy_table.functional_groupings = pt_->policy_table.functional_groupings;
+ snapshot_->policy_table.consumer_friendly_messages->version = pt_->policy_table.consumer_friendly_messages->version;
+ snapshot_->policy_table.consumer_friendly_messages->mark_initialized();
+ snapshot_->policy_table.module_config = pt_->policy_table.module_config;
+ snapshot_->policy_table.module_meta = pt_->policy_table.module_meta;
+ snapshot_->policy_table.usage_and_error_counts = pt_->policy_table.usage_and_error_counts;
+ snapshot_->policy_table.device_data = pt_->policy_table.device_data;
+
+ //Set policy table type to Snapshot
+ snapshot_->SetPolicyTableType(rpc::policy_table_interface_base::PolicyTableType::PT_SNAPSHOT);
+
CheckSnapshotInitialization();
return snapshot_;
}