timestamp fix
This commit is contained in:
parent
6753fe01a1
commit
572f0f23ed
2
external/keyring-manager
vendored
2
external/keyring-manager
vendored
@ -1 +1 @@
|
|||||||
Subproject commit c153eb3015d6d118e5d467865510d053ddd84533
|
Subproject commit b127b2d3c653fea163a776dd58b3798f28aeeee3
|
@ -1346,19 +1346,19 @@ impl NetworkManager {
|
|||||||
let ts = get_timestamp();
|
let ts = get_timestamp();
|
||||||
let ets = envelope.get_timestamp();
|
let ets = envelope.get_timestamp();
|
||||||
if let Some(tsbehind) = tsbehind {
|
if let Some(tsbehind) = tsbehind {
|
||||||
if tsbehind > 0 && (ts > ets && ts - ets > tsbehind) {
|
if tsbehind > 0 && (ts > ets && ts.saturating_sub(ets) > tsbehind) {
|
||||||
log_net!(debug
|
log_net!(debug
|
||||||
"envelope time was too far in the past: {}ms ",
|
"envelope time was too far in the past: {}ms ",
|
||||||
timestamp_to_secs(ts - ets) * 1000f64
|
timestamp_to_secs(ts.saturating_sub(ets)) * 1000f64
|
||||||
);
|
);
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(tsahead) = tsahead {
|
if let Some(tsahead) = tsahead {
|
||||||
if tsahead > 0 && (ts < ets && ets - ts > tsahead) {
|
if tsahead > 0 && (ts < ets && ets.saturating_sub(ts) > tsahead) {
|
||||||
log_net!(debug
|
log_net!(debug
|
||||||
"envelope time was too far in the future: {}ms",
|
"envelope time was too far in the future: {}ms",
|
||||||
timestamp_to_secs(ets - ts) * 1000f64
|
timestamp_to_secs(ets.saturating_sub(ts)) * 1000f64
|
||||||
);
|
);
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ impl NetworkManager {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// While we're here, lets see if this address has timed out
|
// While we're here, lets see if this address has timed out
|
||||||
if cur_ts - stats.last_seen_ts >= IPADDR_MAX_INACTIVE_DURATION_US {
|
if cur_ts.saturating_sub(stats.last_seen_ts) >= IPADDR_MAX_INACTIVE_DURATION_US {
|
||||||
// it's dead, put it in the dead list
|
// it's dead, put it in the dead list
|
||||||
dead_addrs.insert(*addr);
|
dead_addrs.insert(*addr);
|
||||||
}
|
}
|
||||||
|
@ -721,7 +721,7 @@ impl BucketEntryInner {
|
|||||||
self.transfer_stats_accounting.add_down(bytes);
|
self.transfer_stats_accounting.add_down(bytes);
|
||||||
self.peer_stats.rpc_stats.messages_rcvd += 1;
|
self.peer_stats.rpc_stats.messages_rcvd += 1;
|
||||||
self.peer_stats.rpc_stats.questions_in_flight -= 1;
|
self.peer_stats.rpc_stats.questions_in_flight -= 1;
|
||||||
self.record_latency(recv_ts - send_ts);
|
self.record_latency(recv_ts.saturating_sub(send_ts));
|
||||||
self.touch_last_seen(recv_ts);
|
self.touch_last_seen(recv_ts);
|
||||||
self.peer_stats.rpc_stats.recent_lost_answers = 0;
|
self.peer_stats.rpc_stats.recent_lost_answers = 0;
|
||||||
}
|
}
|
||||||
|
@ -319,7 +319,7 @@ pub trait NodeRefBase: Sized {
|
|||||||
self.operate_mut(|rti, e| {
|
self.operate_mut(|rti, e| {
|
||||||
rti.transfer_stats_accounting().add_down(bytes);
|
rti.transfer_stats_accounting().add_down(bytes);
|
||||||
rti.latency_stats_accounting()
|
rti.latency_stats_accounting()
|
||||||
.record_latency(recv_ts - send_ts);
|
.record_latency(recv_ts.saturating_sub(send_ts));
|
||||||
e.answer_rcvd(send_ts, recv_ts, bytes);
|
e.answer_rcvd(send_ts, recv_ts, bytes);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1597,7 +1597,7 @@ impl RouteSpecStore {
|
|||||||
.remote_private_route_cache
|
.remote_private_route_cache
|
||||||
.entry(pr_pubkey)
|
.entry(pr_pubkey)
|
||||||
.and_modify(|rpr| {
|
.and_modify(|rpr| {
|
||||||
if cur_ts - rpr.last_touched_ts >= REMOTE_PRIVATE_ROUTE_CACHE_EXPIRY {
|
if cur_ts.saturating_sub(rpr.last_touched_ts) >= REMOTE_PRIVATE_ROUTE_CACHE_EXPIRY {
|
||||||
// Start fresh if this had expired
|
// Start fresh if this had expired
|
||||||
rpr.last_seen_our_node_info_ts = 0;
|
rpr.last_seen_our_node_info_ts = 0;
|
||||||
rpr.last_touched_ts = cur_ts;
|
rpr.last_touched_ts = cur_ts;
|
||||||
@ -1640,7 +1640,7 @@ impl RouteSpecStore {
|
|||||||
F: FnOnce(&mut RemotePrivateRouteInfo) -> R,
|
F: FnOnce(&mut RemotePrivateRouteInfo) -> R,
|
||||||
{
|
{
|
||||||
let rpr = inner.cache.remote_private_route_cache.get_mut(key)?;
|
let rpr = inner.cache.remote_private_route_cache.get_mut(key)?;
|
||||||
if cur_ts - rpr.last_touched_ts < REMOTE_PRIVATE_ROUTE_CACHE_EXPIRY {
|
if cur_ts.saturating_sub(rpr.last_touched_ts) < REMOTE_PRIVATE_ROUTE_CACHE_EXPIRY {
|
||||||
rpr.last_touched_ts = cur_ts;
|
rpr.last_touched_ts = cur_ts;
|
||||||
return Some(f(rpr));
|
return Some(f(rpr));
|
||||||
}
|
}
|
||||||
@ -1662,7 +1662,7 @@ impl RouteSpecStore {
|
|||||||
match inner.cache.remote_private_route_cache.entry(*key) {
|
match inner.cache.remote_private_route_cache.entry(*key) {
|
||||||
hashlink::lru_cache::Entry::Occupied(mut o) => {
|
hashlink::lru_cache::Entry::Occupied(mut o) => {
|
||||||
let rpr = o.get_mut();
|
let rpr = o.get_mut();
|
||||||
if cur_ts - rpr.last_touched_ts < REMOTE_PRIVATE_ROUTE_CACHE_EXPIRY {
|
if cur_ts.saturating_sub(rpr.last_touched_ts) < REMOTE_PRIVATE_ROUTE_CACHE_EXPIRY {
|
||||||
return Some(f(rpr));
|
return Some(f(rpr));
|
||||||
}
|
}
|
||||||
o.remove();
|
o.remove();
|
||||||
|
@ -45,7 +45,7 @@ impl TransferStatsAccounting {
|
|||||||
cur_ts: u64,
|
cur_ts: u64,
|
||||||
transfer_stats: &mut TransferStatsDownUp,
|
transfer_stats: &mut TransferStatsDownUp,
|
||||||
) {
|
) {
|
||||||
let dur_ms = (cur_ts - last_ts) / 1000u64;
|
let dur_ms = cur_ts.saturating_sub(last_ts) / 1000u64;
|
||||||
while self.rolling_transfers.len() >= ROLLING_TRANSFERS_SIZE {
|
while self.rolling_transfers.len() >= ROLLING_TRANSFERS_SIZE {
|
||||||
self.rolling_transfers.pop_front();
|
self.rolling_transfers.pop_front();
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ where
|
|||||||
//xxx: causes crash (Missing otel data span extensions)
|
//xxx: causes crash (Missing otel data span extensions)
|
||||||
// Span::current().follows_from(span_id);
|
// Span::current().follows_from(span_id);
|
||||||
|
|
||||||
(ret, end_ts - start_ts)
|
(ret, end_ts.saturating_sub(start_ts))
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user