From a65fb8b60be13e2d60fd3ad275d96a80305b79e6 Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Wed, 17 Dec 2025 13:23:27 +0000 Subject: [PATCH] node/wire: manage logs for error establishing connection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of logging all IO errors as an error, match on the kind of the error, logging an info message, otherwise an error. These errors are informational, and cannot necessarily be resolved by the node operator – since it is a matter of not being able to connect to another end. --- crates/radicle-node/src/wire.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/radicle-node/src/wire.rs b/crates/radicle-node/src/wire.rs index 6736bc334..fc03a85b0 100644 --- a/crates/radicle-node/src/wire.rs +++ b/crates/radicle-node/src/wire.rs @@ -990,7 +990,7 @@ where .push_back(reactor::Action::RegisterTransport(token, transport)); } Err(err) => { - log::error!(target: "wire", "Error establishing connection to {addr}: {err}"); + logger::establish_connection(&addr, &err); self.service.disconnected( node_id, @@ -1221,6 +1221,21 @@ fn session>( WireSession::new(proxy, noise) } +mod logger { + use radicle::node::Address; + + pub fn establish_connection(addr: &Address, err: &std::io::Error) { + use std::io::ErrorKind::*; + match err.kind() { + ConnectionRefused | ConnectionReset | HostUnreachable | ConnectionAborted + | NotConnected => { + log::info!(target: "wire", "Could not establish connection to {addr}: {err}") + } + _ => log::error!(target: "wire", "Error establishing connection to {addr}: {err}"), + } + } +} + #[cfg(test)] mod test { use super::*;