fix(tun): avoid service IPC startup race on Windows (#6340)

* fix(tun): avoid service IPC startup race on Windows

* docs: Changelog.md

* style: prettier
This commit is contained in:
Slinetrac
2026-02-22 13:09:47 +00:00
committed by GitHub
parent 700011688b
commit 1bf445ddcc
5 changed files with 16 additions and 22 deletions
+7 -1
View File
@@ -83,7 +83,7 @@ impl CoreManager {
#[cfg(target_os = "windows")]
async fn wait_for_service_if_needed(&self) {
use crate::{config::Config, constants::timing};
use crate::{config::Config, constants::timing, core::service};
use backoff::{Error as BackoffError, ExponentialBackoff};
let needs_service = Config::verge().await.latest_arc().enable_tun_mode.unwrap_or(false);
@@ -108,6 +108,12 @@ impl CoreManager {
return Ok(());
}
// If the service IPC path is not ready yet, treat it as transient and retry.
// Running init/refresh too early can mark service state unavailable and break later config reloads.
if !service::is_service_ipc_path_exists() {
return Err(BackoffError::transient(anyhow::anyhow!("Service IPC not ready")));
}
manager.init().await.map_err(BackoffError::transient)?;
let _ = manager.refresh().await;