From e0ab17f665bb476329e0c7f980f31bb10cbfc944 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 24 Oct 2026 05:58:37 +0200 Subject: add traffic counter This introduces a new wrapper that counts messages and payload bytes per peer, split by kind (hello, helloReply, sync, ping, pong), each sent, received and refused. The traffic counter goes around the firewall, which means messages dropped outbound are still counted as sent, and messages dropped inbound don't count as received. --- src/state.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/state.rs') diff --git a/src/state.rs b/src/state.rs index 769dbad..c3b23de 100644 --- a/src/state.rs +++ b/src/state.rs @@ -517,6 +517,8 @@ pub(crate) struct AppState { pub(crate) peer_states: Arc>>>>, pub(crate) transport: Arc, pub(crate) firewall: Arc, + /// Messages and bytes exchanged, per peer (`transport::traffic`). + pub(crate) traffic: Arc, pub(crate) sync_events: mpsc::UnboundedSender, -- cgit v1.3.1