From 8352c3c67ac65d1a4981c7bceeb68beeef36e9ca Mon Sep 17 00:00:00 2001 From: NianJiuZst <3235467914@qq.com> Date: Thu, 20 Aug 2026 13:37:30 +0800 Subject: [PATCH] fix(daemon): refresh stale idle-task comment After folding the IPC connection count and activity timestamp into a single mutex-protected IpcActivityState, the idle task no longer references the connection count directly; should_exit_for_idle already returns false while a connection is open or within the idle window. Update the comment to describe the post-refactor control flow so it matches the code. --- crates/bsk-cli/src/daemon/start.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/bsk-cli/src/daemon/start.rs b/crates/bsk-cli/src/daemon/start.rs index 7c35ea7..8580067 100644 --- a/crates/bsk-cli/src/daemon/start.rs +++ b/crates/bsk-cli/src/daemon/start.rs @@ -350,11 +350,13 @@ pub fn run_foreground(cfg: DaemonConfig) -> Result<()> { if !ipc_is_idle { continue; } - // Bridge from M2/M3 (which only knew about connection - // counts) to M4/M5 (browser + session registries): - // hold the daemon alive while any IPC client is - // connected, any browser is paired, or any session - // is live (design §3.2). + // IPC liveness (open-connection count + idle window) is already + // enforced above by `should_exit_for_idle`, which reads + // `IpcActivityState` under one lock and returns true only when + // there are zero connections AND the idle interval has elapsed. + // Here we additionally hold the daemon alive while any browser + // is paired or any session is live (design §3.2, M4/M5 + // registries). if !state.browsers.is_empty() || !state.sessions.is_empty() { continue; }