Some debug log for file announcement

This commit is contained in:
boqiu 2024-12-04 11:15:50 +08:00
parent 37a601cef1
commit d3480784fb

View File

@ -365,6 +365,14 @@ impl Libp2pEventHandler {
self.on_find_chunks(msg).await self.on_find_chunks(msg).await
} }
PubsubMessage::AnnounceFile(msgs) => { PubsubMessage::AnnounceFile(msgs) => {
let maybe_peer = self.network_globals.peers.read().peer_info(&source).cloned();
let ip = maybe_peer.clone().map(|info| info.seen_ip_addresses().collect::<Vec<IpAddr>>());
let agent = maybe_peer.clone().map(|info| info.client().agent_string.clone());
let connection = maybe_peer.map(|info| info.connection_status().clone());
debug!(batch = %msgs.len(), %source, ?ip, ?agent, ?connection, "Received AnnounceFile pubsub message");
metrics::LIBP2P_HANDLE_PUBSUB_ANNOUNCE_FILE.mark(1); metrics::LIBP2P_HANDLE_PUBSUB_ANNOUNCE_FILE.mark(1);
for msg in msgs { for msg in msgs {