From 0eb2af8d465cd99f983cd25bad8ba17b2b133a60 Mon Sep 17 00:00:00 2001 From: neoapps-dev Date: Sun, 12 Jul 2026 16:55:08 +0300 Subject: [PATCH] fix(lceonline): windows workaround --- src-tauri/src/networking/relay.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/networking/relay.rs b/src-tauri/src/networking/relay.rs index 40c3a09..f4773c5 100644 --- a/src-tauri/src/networking/relay.rs +++ b/src-tauri/src/networking/relay.rs @@ -251,6 +251,18 @@ pub async fn join_game( ip: host_ip, port: host_port, }; - #[cfg(target_os = "windows")] sleep(tokio::time::Duration::from_millis(3000)).await; //neo: workaround for Windows having a race condition where the game is launched before the relay proxy + #[cfg(target_os = "windows")] + { + let deadline = tokio::time::Instant::now() + tokio::time::Duration::from_secs(10); + loop { + if tokio::net::TcpStream::connect(format!("127.0.0.1:{}", host_port)).await.is_ok() { + break; + } + if tokio::time::Instant::now() >= deadline { + return Err("Timed out waiting for relay proxy".into()); + } + tokio::time::sleep(std::time::Duration::from_millis(200)).await; + } + } //neo: workaround for Windows having a race condition where the game is launched before the relay proxy crate::commands::game::launch_game(app, game_state, instance_id, vec![server], vec![]).await }