fix: serialize OS state reads with in-progress update_sysproxy

This commit is contained in:
wonfen
2026-04-22 12:20:26 +08:00
parent 1eb194d0f9
commit 4d408a8c1a
4 changed files with 15 additions and 2 deletions
+3
View File
@@ -1,5 +1,6 @@
use super::CmdResult;
use crate::cmd::StringifyErr as _;
use crate::core::sysopt::Sysopt;
use clash_verge_logging::{Type, logging};
use gethostname::gethostname;
use network_interface::NetworkInterface;
@@ -13,6 +14,7 @@ use tauri_plugin_clash_verge_sysinfo;
pub async fn get_sys_proxy() -> CmdResult<Mapping> {
logging!(debug, Type::Network, "异步获取系统代理配置");
Sysopt::global().wait_idle().await;
let sys_proxy = Sysproxy::get_system_proxy().stringify_err()?;
let Sysproxy {
ref host,
@@ -40,6 +42,7 @@ pub async fn get_sys_proxy() -> CmdResult<Mapping> {
/// 获取自动代理配置
#[tauri::command]
pub async fn get_auto_proxy() -> CmdResult<Mapping> {
Sysopt::global().wait_idle().await;
let auto_proxy = Autoproxy::get_auto_proxy().stringify_err()?;
let Autoproxy { ref enable, ref url } = auto_proxy;