From 5b3946c363c885255e1347f6329e0071df5d9c46 Mon Sep 17 00:00:00 2001 From: boqiu <82121246@qq.com> Date: Wed, 4 Dec 2024 15:56:21 +0800 Subject: [PATCH] add incoming stats for discv5 --- node/router/src/service.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/node/router/src/service.rs b/node/router/src/service.rs index 54007d2..1135bc7 100644 --- a/node/router/src/service.rs +++ b/node/router/src/service.rs @@ -140,7 +140,12 @@ impl RouterService { .filter(|n| n.2.is_connected()) .count(); let disconnected_nodes = discovered_nodes.len() - connected_nodes; - debug!(%connected_nodes, %disconnected_nodes, "qbit - network statistics for discv5"); + let incoming_nodes = discovered_nodes + .iter() + .filter(|n| n.2.is_incoming()) + .count(); + let outgoing_nodes = discovered_nodes.len() - incoming_nodes; + debug!(%connected_nodes, %disconnected_nodes, %incoming_nodes, %outgoing_nodes, "qbit - network statistics for discv5"); let gossip = self.libp2p.swarm.behaviour().gs(); let all_peers = gossip.all_peers().count();