mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2024-12-26 08:15:17 +00:00
refactor log
This commit is contained in:
parent
5b3946c363
commit
c548cb388c
@ -365,22 +365,6 @@ impl Libp2pEventHandler {
|
||||
self.on_find_chunks(msg).await
|
||||
}
|
||||
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);
|
||||
|
||||
for msg in msgs {
|
||||
|
@ -14,6 +14,7 @@ use network::{
|
||||
use pruner::PrunerMessage;
|
||||
use shared_types::timestamp_now;
|
||||
use std::collections::HashMap;
|
||||
use std::net::IpAddr;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use storage::log_store::Store as LogStore;
|
||||
@ -235,6 +236,25 @@ impl RouterService {
|
||||
message,
|
||||
..
|
||||
} => {
|
||||
if matches!(message, PubsubMessage::AnnounceFile(..)) {
|
||||
let maybe_peer = self
|
||||
.network_globals
|
||||
.peers
|
||||
.read()
|
||||
.peer_info(&source)
|
||||
.cloned();
|
||||
|
||||
if let Some(peer) = maybe_peer {
|
||||
let ip = peer.seen_ip_addresses().collect::<Vec<IpAddr>>();
|
||||
let agent = peer.client().agent_string.clone();
|
||||
let connection = peer.connection_status().clone();
|
||||
let conn_dir = peer.connection_direction().cloned();
|
||||
debug!(%source, ?ip, ?agent, ?connection, ?conn_dir, "Received AnnounceFile pubsub message");
|
||||
} else {
|
||||
debug!(%source, "Received AnnounceFile pubsub message, but not found in peer db");
|
||||
}
|
||||
}
|
||||
|
||||
let result = self
|
||||
.libp2p_event_handler
|
||||
.on_pubsub_message(propagation_source, source, &id, message)
|
||||
|
Loading…
Reference in New Issue
Block a user