Skip to content

Commit

Permalink
Show connection ID info when connection fails
Browse files Browse the repository at this point in the history
This error path was coming up with some RecvError, which needs its own
investigation. For now, at least show which connection id failed.

Example log before this change:
ERROR utp_rs::socket: Failed to open connection with cid err=RecvError(())

Example after:
ERROR utp_rs::socket: Failed to open connection with ConnectionId { send: 8729, recv: 8728, peer: 127.0.0.1:3400 } err=RecvError(())
  • Loading branch information
carver committed Jun 10, 2023
1 parent a799eb4 commit 0ca2a02
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ where

self.pause_while_stressed().await;

let cid_info = format!("{:?}", cid);
let stream = UtpStream::new(
cid,
config,
Expand All @@ -360,7 +361,7 @@ where
Err(err)
}
Err(err) => {
tracing::error!(?err, "Failed to open connection with cid");
tracing::error!(?err, "Failed to open connection with {cid_info}");
Err(io::Error::from(io::ErrorKind::TimedOut))
},
}
Expand Down

0 comments on commit 0ca2a02

Please sign in to comment.