1 Commits

Author SHA1 Message Date
restitux 25ec34d7e7 common: resolve ping addresses with async DNS
Build Mumble Web 2 / macos_build (push) Successful in 1m20s
Build Mumble Web 2 / linux_build (push) Successful in 1m27s
Build Mumble Web 2 / windows_build (push) Successful in 2m57s
Build Mumble Web 2 / android_build (push) Successful in 4m40s
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) <noreply@anthropic.com>
2026-05-05 18:18:07 -06:00
+3 -4
View File
@@ -25,12 +25,11 @@ pub struct ServerStatus {
#[cfg(feature = "networking")]
pub async fn ping_server(address: &str, port: u16) -> color_eyre::Result<ServerStatus> {
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"))?;