From 314c88337a008450344d18610af43b321682b9e7 Mon Sep 17 00:00:00 2001 From: Friedel Ziegelmayer Date: Tue, 9 Apr 2024 11:06:17 +0200 Subject: [PATCH] fix(iroh-cli): doctor relay-urls, correct connection logic (#2163) --- iroh-cli/src/commands/doctor.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/iroh-cli/src/commands/doctor.rs b/iroh-cli/src/commands/doctor.rs index dba86dcbea..c55417cb3e 100644 --- a/iroh-cli/src/commands/doctor.rs +++ b/iroh-cli/src/commands/doctor.rs @@ -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"); @@ -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 {