Skip to content

Commit

Permalink
fix(iroh-cli): doctor relay-urls, correct connection logic (#2163)
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed Apr 9, 2024
1 parent fcdc299 commit 314c883
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions iroh-cli/src/commands/doctor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -803,8 +803,12 @@ async fn relay_urls(count: usize, config: NodeConfig) -> anyhow::Result<()> {

let client = clients.get(&node.url).map(|(c, _)| c.clone()).unwrap();

let start = std::time::Instant::now();
if client.is_connected().await? {
client.close_for_reconnect().await?;
}
assert!(!client.is_connected().await?);

let start = std::time::Instant::now();
match tokio::time::timeout(Duration::from_secs(2), client.connect()).await {
Err(e) => {
tracing::warn!("connect timeout");
Expand All @@ -829,9 +833,7 @@ async fn relay_urls(count: usize, config: NodeConfig) -> anyhow::Result<()> {
}
}
}
// disconnect, to be able to measure reconnects
client.close_for_reconnect().await?;
assert!(!client.is_connected().await?);

if node_details.error.is_none() {
success.push(node_details);
} else {
Expand Down

0 comments on commit 314c883

Please sign in to comment.