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
+8
View File
@@ -106,6 +106,14 @@ impl Sysopt {
}
}
/// Wait for any in-progress `update_sysproxy` to finish, so that a
/// subsequent read of OS-level sysproxy state sees a fully applied
/// configuration instead of a partially-applied one (e.g. SOCKS already
/// disabled but HTTP still enabled mid-transition).
pub async fn wait_idle(&self) {
let _ = self.update_lock.lock().await;
}
/// init the sysproxy
pub async fn update_sysproxy(&self) -> Result<()> {
let _lock = self.update_lock.lock().await;