mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-10-01 01:26:08 -04:00
fix expiration
This commit is contained in:
parent
d269b25a23
commit
b6f1e706f7
@ -207,6 +207,10 @@ impl RPCProcessor {
|
||||
};
|
||||
let ret_expiration = if closer_to_key_peers.len() >= set_value_count {
|
||||
// Not close enough
|
||||
|
||||
#[cfg(feature = "debug-dht")]
|
||||
log_rpc!(debug "Not close enough for watch value");
|
||||
|
||||
Timestamp::default()
|
||||
} else {
|
||||
// Close enough, lets watch it
|
||||
|
@ -746,7 +746,7 @@ where
|
||||
&mut self,
|
||||
key: TypedKey,
|
||||
subkeys: ValueSubkeyRangeSet,
|
||||
expiration: Timestamp,
|
||||
mut expiration: Timestamp,
|
||||
count: u32,
|
||||
target: Target,
|
||||
watcher: CryptoKey,
|
||||
@ -760,7 +760,9 @@ where
|
||||
let cur_ts = get_timestamp();
|
||||
let max_ts = cur_ts + self.limits.max_watch_expiration.as_u64();
|
||||
let min_ts = cur_ts + self.limits.min_watch_expiration.as_u64();
|
||||
if expiration.as_u64() < min_ts || expiration.as_u64() > max_ts {
|
||||
if expiration.as_u64() == 0 {
|
||||
expiration = Timestamp::new(max_ts);
|
||||
} else if expiration.as_u64() < min_ts || expiration.as_u64() > max_ts {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user