diff options
| author | tv <tv@krebsco.de> | 2026-10-27 01:31:58 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-27 01:31:58 +0100 |
| commit | 4cdece6d0f8e25ac154c3fd0f30bca604b08c16a (patch) | |
| tree | 10a6aab1793d1c4fd0bd53c16b600f1adf986cb9 /src/transport/traffic.rs | |
| parent | 5fd686dcd8ddfbdf276c044e5acf03f744e03193 (diff) | |
add identity layer
Diffstat (limited to 'src/transport/traffic.rs')
| -rw-r--r-- | src/transport/traffic.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/transport/traffic.rs b/src/transport/traffic.rs index c27f0d7..59acaf2 100644 --- a/src/transport/traffic.rs +++ b/src/transport/traffic.rs @@ -40,6 +40,9 @@ pub(crate) struct ByKind { pub(crate) ping: Counter, pub(crate) pong: Counter, pub(crate) blob: Counter, + /// WHO and ME (`transport::identity`), counted by the identity layer under the + /// address they went to or came from. + pub(crate) identity: Counter, } impl ByKind { @@ -51,6 +54,7 @@ impl ByKind { MessageKind::Ping => &mut self.ping, MessageKind::Pong => &mut self.pong, MessageKind::Blob => &mut self.blob, + MessageKind::Who | MessageKind::Me => &mut self.identity, } } } @@ -92,15 +96,15 @@ impl Traffic { } } - fn sent(&self, peer: &str, kind: MessageKind, bytes: usize) { + pub(crate) fn sent(&self, peer: &str, kind: MessageKind, bytes: usize) { self.count(peer, bytes, |t| t.sent.get_mut(kind)); } - fn refused(&self, peer: &str, kind: MessageKind, bytes: usize) { + pub(crate) fn refused(&self, peer: &str, kind: MessageKind, bytes: usize) { self.count(peer, bytes, |t| t.refused.get_mut(kind)); } - fn received(&self, peer: &str, kind: MessageKind, bytes: usize) { + pub(crate) fn received(&self, peer: &str, kind: MessageKind, bytes: usize) { self.count(peer, bytes, |t| t.received.get_mut(kind)); } |
