aboutsummaryrefslogtreecommitdiffstats
path: root/src/transport/traffic.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-06 19:54:09 +0100
committertv <tv@krebsco.de>2026-11-06 19:54:09 +0100
commit5994b49412c058079639585501a78e6458fdbb6f (patch)
treeca78aa3cd7d0d6d2a48bfa42d61afcddb8efd6df /src/transport/traffic.rs
parent7c0c318dca3054be6c7bacf5a4b3f5a4e47cc949 (diff)
HyParView (slim)
Diffstat (limited to 'src/transport/traffic.rs')
-rw-r--r--src/transport/traffic.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/transport/traffic.rs b/src/transport/traffic.rs
index 501c77b..291a76b 100644
--- a/src/transport/traffic.rs
+++ b/src/transport/traffic.rs
@@ -57,6 +57,8 @@ pub(crate) struct ByKind {
pub(crate) probe: Counter,
/// PRUNE and GRAFT (`swarm::plumtree`).
pub(crate) plumtree: Counter,
+ /// NEIGHBOUR, NEIGHBOUR_REPLY and DISCONNECT (`swarm::hyparview`).
+ pub(crate) hyparview: Counter,
}
impl ByKind {
@@ -73,6 +75,7 @@ impl ByKind {
MessageKind::Links,
MessageKind::Probe,
MessageKind::Prune,
+ MessageKind::Neighbour,
] {
let theirs = *other.get(kind);
self.get_mut(kind).absorb(theirs);
@@ -92,6 +95,9 @@ impl ByKind {
MessageKind::Links | MessageKind::LinksReply => &self.links,
MessageKind::Probe | MessageKind::ProbeReply => &self.probe,
MessageKind::Prune | MessageKind::Graft => &self.plumtree,
+ MessageKind::Neighbour | MessageKind::NeighbourReply | MessageKind::Disconnect => {
+ &self.hyparview
+ }
}
}
@@ -108,6 +114,9 @@ impl ByKind {
MessageKind::Links | MessageKind::LinksReply => &mut self.links,
MessageKind::Probe | MessageKind::ProbeReply => &mut self.probe,
MessageKind::Prune | MessageKind::Graft => &mut self.plumtree,
+ MessageKind::Neighbour | MessageKind::NeighbourReply | MessageKind::Disconnect => {
+ &mut self.hyparview
+ }
}
}
}
@@ -302,6 +311,9 @@ fn names(kind: MessageKind) -> (&'static str, &'static str) {
MessageKind::ProbeReply => ("PROBE_REPLY", "probe"),
MessageKind::Prune => ("PRUNE", "plumtree"),
MessageKind::Graft => ("GRAFT", "plumtree"),
+ MessageKind::Neighbour => ("NEIGHBOUR", "hyparview"),
+ MessageKind::NeighbourReply => ("NEIGHBOUR_REPLY", "hyparview"),
+ MessageKind::Disconnect => ("DISCONNECT", "hyparview"),
}
}