summaryrefslogtreecommitdiff
path: root/src/components/policy/policy_external/src/policy_manager_impl.cc
diff options
context:
space:
mode:
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.cc20
1 files changed, 14 insertions, 6 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 152a94b963..787e65f43a 100644
--- a/src/components/policy/policy_external/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_external/src/policy_manager_impl.cc
@@ -39,7 +39,6 @@
#include <set>
#include <vector>
#include "config_profile/profile.h"
-#include "json/reader.h"
#include "json/writer.h"
#include "policy/cache_manager.h"
#include "policy/policy_helper.h"
@@ -48,6 +47,7 @@
#include "policy/update_status_manager.h"
#include "utils/date_time.h"
#include "utils/file_system.h"
+#include "utils/jsoncpp_reader_wrapper.h"
#include "utils/logger.h"
#include "policy/access_remote.h"
@@ -238,9 +238,10 @@ void PolicyManagerImpl::set_listener(PolicyListener* listener) {
std::shared_ptr<policy_table::Table> PolicyManagerImpl::Parse(
const BinaryMessage& pt_content) {
std::string json(pt_content.begin(), pt_content.end());
+ utils::JsonReader reader;
Json::Value value;
- Json::Reader reader;
- if (reader.parse(json.c_str(), value)) {
+
+ if (reader.parse(json, &value)) {
return std::make_shared<policy_table::Table>(&value);
} else {
return std::make_shared<policy_table::Table>();
@@ -702,8 +703,8 @@ void PolicyManagerImpl::RequestPTUpdate() {
if (IsPTValid(policy_table_snapshot, policy_table::PT_SNAPSHOT)) {
Json::Value value = policy_table_snapshot->ToJsonValue();
- Json::FastWriter writer;
- std::string message_string = writer.write(value);
+ Json::StreamWriterBuilder writer_builder;
+ std::string message_string = Json::writeString(writer_builder, value);
LOG4CXX_DEBUG(logger_, "Snapshot contents is : " << message_string);
@@ -1383,9 +1384,16 @@ void PolicyManagerImpl::RetrySequenceFailed() {
ResetRetrySequence(ResetRetryCountType::kResetWithStatusUpdate);
}
-void PolicyManagerImpl::OnSystemRequestReceived() {
+void PolicyManagerImpl::ResetTimeout() {
LOG4CXX_AUTO_TRACE(logger_);
+ if (update_status_manager_.IsUpdatePending()) {
+ uint32_t update_timeout = TimeoutExchangeMSec();
+ update_status_manager_.ResetTimeout(update_timeout);
+ }
+}
+void PolicyManagerImpl::OnSystemRequestReceived() {
+ LOG4CXX_AUTO_TRACE(logger_);
IncrementRetryIndex();
}