Skip to content

Commit

Permalink
fix(iroh-net): do not log as error if client disconnects from relay
Browse files Browse the repository at this point in the history
  • Loading branch information
Frando committed May 2, 2024
1 parent 6fbf4a9 commit 580cf33
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions iroh-net/src/relay/http/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,18 @@ impl ServerState {
let service = self.service.clone();
// spawn a task to handle the connection
set.spawn(async move {
if let Err(e) = service
if let Err(error) = service
.handle_connection(stream, tls_config)
.await
{
error!("[{http_str}] relay: failed to handle connection: {e}");
match error.downcast_ref::<std::io::Error>() {
Some(io_error) if io_error.kind() == std::io::ErrorKind::UnexpectedEof => {
debug!(reason=?error, "[{http_str}] relay: peer disconnected");
},
_ => {
error!(?error, "[{http_str}] relay: failed to handle connection");
}
}
}
}.instrument(info_span!("conn", peer = %peer_addr)));
}
Expand Down

0 comments on commit 580cf33

Please sign in to comment.