From f0519a57de28ef281072066082e6298e6760080d Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 25 Mar 2019 15:44:30 +0300 Subject: [PATCH] IS-1199: Enabled freshness Signed-off-by: artem.ivanov --- libindy/src/services/pool/mod.rs | 3 +-- libindy/src/services/pool/request_handler.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/libindy/src/services/pool/mod.rs b/libindy/src/services/pool/mod.rs index a985656512..5d7c356e96 100644 --- a/libindy/src/services/pool/mod.rs +++ b/libindy/src/services/pool/mod.rs @@ -34,7 +34,6 @@ use errors::*; use services::pool::pool::{Pool, ZMQPool}; use utils::environment; use utils::sequence; -use std::u64; mod catchup; mod commander; @@ -266,7 +265,7 @@ impl PoolService { } lazy_static! { - static ref THRESHOLD: Mutex = Mutex::new(u64::MAX); + static ref THRESHOLD: Mutex = Mutex::new(600); } pub fn set_freshness_threshold(threshold: u64) { diff --git a/libindy/src/services/pool/request_handler.rs b/libindy/src/services/pool/request_handler.rs index 7ce7981a82..ce09e4f68e 100644 --- a/libindy/src/services/pool/request_handler.rs +++ b/libindy/src/services/pool/request_handler.rs @@ -392,7 +392,7 @@ impl RequestSM { trace!("Last signed time: {}", last_write_time); if cnt > f || _check_state_proof(&result, f, &generator, &nodes, &raw_msg) - && (_get_freshness_threshold() == u64::MAX || _get_cur_time() as u64 <= _get_freshness_threshold() + last_write_time) { + && _get_cur_time() as u64 <= _get_freshness_threshold() + last_write_time { state.networker.borrow_mut().process_event(Some(NetworkerEvent::CleanTimeout(req_id, None))); _send_ok_replies(&cmd_ids, if cnt > f { &soonest } else { &raw_msg }); (RequestState::finish(), None)