chore: improve incoming connection traces (#2393)

This commit is contained in:
Matthias Seitz
2023-04-25 16:51:41 +02:00
committed by GitHub
parent f373731262
commit addd8d473c
3 changed files with 11 additions and 1 deletions

View File

@ -658,7 +658,7 @@ where
?total_active,
"Session established"
);
debug!(target: "net", peer_enode=%NodeRecord::new(remote_addr, peer_id), "Established peer enode");
debug!(target: "net", kind=%direction, peer_enode=%NodeRecord::new(remote_addr, peer_id), "Established peer enode");
if direction.is_incoming() {
this.swarm

View File

@ -693,6 +693,15 @@ impl Direction {
}
}
impl std::fmt::Display for Direction {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Direction::Incoming => write!(f, "incoming"),
Direction::Outgoing(_) => write!(f, "outgoing"),
}
}
}
/// The error thrown when the max configured limit has been reached and no more connections are
/// accepted.
#[derive(Debug, Clone, thiserror::Error)]

View File

@ -221,6 +221,7 @@ where
match self.sessions.on_incoming(stream, remote_addr) {
Ok(session_id) => {
trace!(target: "net", ?remote_addr, "Incoming connection");
return Some(SwarmEvent::IncomingTcpConnection { session_id, remote_addr })
}
Err(err) => {