aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/stats.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/swarm/stats.rs')
-rw-r--r--src/swarm/stats.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/swarm/stats.rs b/src/swarm/stats.rs
index b51a802..191f4e9 100644
--- a/src/swarm/stats.rs
+++ b/src/swarm/stats.rs
@@ -146,6 +146,11 @@ pub(crate) struct Relay {
/// The changes new to us that sync messages brought (beside what they carried that
/// we had): with `carrying` less `nothing_new`, how many a message with news brings.
pub(crate) new_changes: u64,
+ /// Changes peers asked for that we had counted as theirs, as another parent in
+ /// their writer's tree brings them (`SyncSession::known_to_peer`): within 2 s of
+ /// counting them so (so they weren't what we passed on built on), and later.
+ pub(crate) asked_known_lately: u64,
+ pub(crate) asked_known_later: u64,
/// Changes from elsewhere that came not along a writer's tree (pulled, with an
/// answer, sent again, fetched as a delta), and their delays summed (as `Propagation`).
pub(crate) off_tree: u64,
@@ -285,6 +290,15 @@ impl NodeStats {
inner.relay.carrying_bloom_bytes += sizes.1 as u64;
}
+ /// A peer asked for changes we had counted as its (`SyncSession::resend_if_needed`).
+ pub(crate) fn asked_known_elsewhere(&self, (lately, later): (usize, usize)) {
+ if lately + later > 0 {
+ let mut inner = self.lock();
+ inner.relay.asked_known_lately += lately as u64;
+ inner.relay.asked_known_later += later as u64;
+ }
+ }
+
/// A sync message brought `count` changes new to us.
pub(crate) fn new_changes(&self, count: usize) {
self.lock().relay.new_changes += count as u64;