Skip to content

Commit db36c65

Browse files
authored
feat: Add the timeout duration to the relay dial error (#3406)
## Description This adds the timeout used to the error. This error ends up being logged, knowing the actual timeout exceeded is kind of useful. ## Breaking Changes None ## Notes & open questions My first attempt at using snafu. Hopefully this is about right. ## Change checklist <!-- Remove any that are not relevant. --> - [x] Self-review.
1 parent 8426241 commit db36c65

File tree

1 file changed

+6
-3
lines changed
  • iroh/src/magicsock/transports/relay

1 file changed

+6
-3
lines changed

iroh/src/magicsock/transports/relay/actor.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ enum RunError {
258258
})]
259259
#[derive(Debug, Snafu)]
260260
enum DialError {
261-
#[snafu(display("timeout trying to establish a connection"))]
262-
Timeout {},
261+
#[snafu(display("timeout (>{timeout:?}) trying to establish a connection"))]
262+
Timeout { timeout: Duration },
263263
#[snafu(display("unable to connect"))]
264264
Connect {
265265
#[snafu(source(from(ConnectError, Box::new)))]
@@ -498,7 +498,10 @@ impl ActiveRelayActor {
498498
match time::timeout(CONNECT_TIMEOUT, client_builder.connect()).await {
499499
Ok(Ok(client)) => Ok(client),
500500
Ok(Err(err)) => Err(ConnectSnafu.into_error(err)),
501-
Err(_) => Err(TimeoutSnafu.build()),
501+
Err(_) => Err(TimeoutSnafu {
502+
timeout: CONNECT_TIMEOUT,
503+
}
504+
.build()),
502505
}
503506
}
504507
}

0 commit comments

Comments
 (0)