Skip to content

Commit

Permalink
Log the connection ID when connection fails
Browse files Browse the repository at this point in the history
Bonus: show the log for the socket test starting
  • Loading branch information
carver committed Jun 6, 2023
1 parent c92ee36 commit 9a4a0ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,14 @@ where

match connected_rx.await {
Ok(Ok(..)) => Ok(stream),
Ok(Err(err)) => Err(err),
Err(..) => Err(io::Error::from(io::ErrorKind::TimedOut)),
Ok(Err(err)) => {
tracing::error!(?err, "Got error when trying to open connection with cid");
Err(err)
}
Err(err) => {
tracing::error!(?err, "Failed to open connection with cid");
Err(io::Error::from(io::ErrorKind::TimedOut))
},
}
}

Expand Down
2 changes: 2 additions & 0 deletions tests/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use utp_rs::socket::UtpSocket;
async fn socket() {
tracing_subscriber::fmt::init();

tracing::info!("starting socket test");

let recv_addr = SocketAddr::from(([127, 0, 0, 1], 3400));
let send_addr = SocketAddr::from(([127, 0, 0, 1], 3401));

Expand Down

0 comments on commit 9a4a0ee

Please sign in to comment.