diff --git a/src-tauri/src/cmd/profile.rs b/src-tauri/src/cmd/profile.rs index 2d0c06309..db5cfe094 100644 --- a/src-tauri/src/cmd/profile.rs +++ b/src-tauri/src/cmd/profile.rs @@ -350,7 +350,6 @@ pub async fn patch_profiles_config(profiles: IProfiles) -> CmdResult CmdResult { logging!(info, Type::Cmd, "切换配置到: {}", profile_index); diff --git a/src-tauri/src/core/tray/speed_task.rs b/src-tauri/src/core/tray/speed_task.rs index 3115e59d9..8c024b50a 100644 --- a/src-tauri/src/core/tray/speed_task.rs +++ b/src-tauri/src/core/tray/speed_task.rs @@ -10,8 +10,6 @@ use tauri_plugin_mihomo::models::WsConnectionId; /// 托盘速率流异常后的重连间隔。 const TRAY_SPEED_RETRY_DELAY: Duration = Duration::from_secs(1); -/// 托盘速率流运行时的空闲轮询间隔。 -const TRAY_SPEED_IDLE_POLL_INTERVAL: Duration = Duration::from_millis(200); /// 托盘速率流在此时间内收不到有效数据时,触发重连并降级到 0/0。 const TRAY_SPEED_STALE_TIMEOUT: Duration = Duration::from_secs(5); @@ -88,9 +86,7 @@ impl TraySpeedController { loop { let next_state = speed_stream - .next_event(TRAY_SPEED_IDLE_POLL_INTERVAL, TRAY_SPEED_STALE_TIMEOUT, || { - handle::Handle::global().is_exiting() - }) + .next_event(TRAY_SPEED_STALE_TIMEOUT, || handle::Handle::global().is_exiting()) .await; match next_state { diff --git a/src-tauri/src/enhance/tun.rs b/src-tauri/src/enhance/tun.rs index e84c0fe58..df4599b51 100644 --- a/src-tauri/src/enhance/tun.rs +++ b/src-tauri/src/enhance/tun.rs @@ -10,17 +10,6 @@ macro_rules! revise { }; } -// if key not exists then append value -#[allow(unused_macros)] -macro_rules! append { - ($map: expr, $key: expr, $val: expr) => { - let ret_key = Value::String($key.into()); - if !$map.contains_key(&ret_key) { - $map.insert(ret_key, Value::from($val)); - } - }; -} - pub fn use_tun(mut config: Mapping, enable: bool) -> Mapping { let tun_key = Value::from("tun"); let tun_val = config.get(&tun_key); diff --git a/src-tauri/src/utils/connections_stream.rs b/src-tauri/src/utils/connections_stream.rs index f7d3d4e0d..e76193fce 100644 --- a/src-tauri/src/utils/connections_stream.rs +++ b/src-tauri/src/utils/connections_stream.rs @@ -96,15 +96,9 @@ impl MihomoWsEventStream { /// 等待下一次可用事件或结束状态。 /// /// # Arguments - /// * `idle_poll_interval` - 空闲检查间隔 /// * `stale_timeout` - 无有效事件超时时间 /// * `should_exit` - 上层退出判定函数 - pub async fn next_event( - &mut self, - _idle_poll_interval: Duration, // 签名保留,但内部逻辑已进化为更高效的驱动方式 - stale_timeout: Duration, - should_exit: F, - ) -> StreamConsumeState + pub async fn next_event(&mut self, stale_timeout: Duration, should_exit: F) -> StreamConsumeState where F: Fn() -> bool, {