From fd1ccc0c8cfe91b966265271ab758f5dec468151 Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Thu, 5 Mar 2026 15:04:28 -0700 Subject: [PATCH] fix race condition in wan ip check --- core/src/net/gateway.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/net/gateway.rs b/core/src/net/gateway.rs index 2ec976702..a377eb453 100644 --- a/core/src/net/gateway.rs +++ b/core/src/net/gateway.rs @@ -1238,8 +1238,7 @@ async fn poll_ip_info( device_type, Some(NetworkInterfaceType::Bridge | NetworkInterfaceType::Loopback) ) { - *prev_attempt = Some(Instant::now()); - match get_wan_ipv4(iface.as_str(), &ifconfig_url).await { + let res = match get_wan_ipv4(iface.as_str(), &ifconfig_url).await { Ok(a) => a, Err(e) => { tracing::error!( @@ -1253,7 +1252,9 @@ async fn poll_ip_info( tracing::debug!("{e:?}"); None } - } + }; + *prev_attempt = Some(Instant::now()); + res } else { None };