From 25ec34d7e7767825abaa8766ebdba6cec55b9247 Mon Sep 17 00:00:00 2001 From: restitux Date: Wed, 6 May 2026 00:11:52 +0000 Subject: [PATCH] common: resolve ping addresses with async DNS The previous std::net::ToSocketAddrs call blocked the runtime during DNS lookup. This change allows the server ping status to be resolved asynchronously. Co-Authored-By: Claude Opus 4.7 (1M context) --- common/src/lib.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/common/src/lib.rs b/common/src/lib.rs index a3277a6..6d9a3b1 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -25,12 +25,11 @@ pub struct ServerStatus { #[cfg(feature = "networking")] pub async fn ping_server(address: &str, port: u16) -> color_eyre::Result { use color_eyre::eyre::{bail, eyre}; - use std::net::ToSocketAddrs; use std::time::Duration; - use tokio::net::UdpSocket; + use tokio::net::{lookup_host, UdpSocket}; - let dest = format!("{}:{}", address, port) - .to_socket_addrs()? + let dest = lookup_host(format!("{}:{}", address, port)) + .await? .next() .ok_or_else(|| eyre!("could not resolve address"))?; -- 2.52.0