From dc2f6a2508742989887e6e40789c0846d1ac94cd Mon Sep 17 00:00:00 2001 From: Nick Steel Date: Fri, 24 Jan 2025 18:30:48 +0000 Subject: [PATCH] core: include AP handshake in 5s timeout --- core/src/connection/mod.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/src/connection/mod.rs b/core/src/connection/mod.rs index 6f2c7d440..0af974a67 100644 --- a/core/src/connection/mod.rs +++ b/core/src/connection/mod.rs @@ -63,10 +63,12 @@ impl From for AuthenticationError { } pub async fn connect(host: &str, port: u16, proxy: Option<&Url>) -> io::Result { - const TIMEOUT: Duration = Duration::from_secs(3); - let socket = tokio::time::timeout(TIMEOUT, crate::socket::connect(host, port, proxy)).await??; - - handshake(socket).await + const TIMEOUT: Duration = Duration::from_secs(5); + tokio::time::timeout(TIMEOUT, { + let socket = crate::socket::connect(host, port, proxy).await?; + debug!("Connection to AP established."); + handshake(socket) + }).await? } pub async fn connect_with_retry( @@ -80,7 +82,7 @@ pub async fn connect_with_retry( match connect(host, port, proxy).await { Ok(f) => return Ok(f), Err(e) => { - debug!("Connection failed: {e}"); + debug!("Connection to \"{host}:{port}\" failed: {e}"); if num_retries < max_retries { num_retries += 1; debug!("Retry access point...");