From f3610db8460a09a9933737c93b2fae64b89e0ee6 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Fri, 4 Dec 2026 15:18:29 +0800 Subject: [PATCH] fix(linux): recheck PreparingForSleep right before starting --server should_start_server reads the property before force_stop_server() (a kill plus 300 ms) and, on the DRM greeter path, before the 1 s grace that precedes the root fallback. A sleep requested in that gap still got a --server. Check again in start_server; the skipped start is retried on the next tick as before. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01JAxkkig1bcC5Xrr1uwX47b --- src/platform/linux.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/platform/linux.rs b/src/platform/linux.rs index 476f6c8bd..632024306 100644 --- a/src/platform/linux.rs +++ b/src/platform/linux.rs @@ -1142,6 +1142,11 @@ fn try_start_server_(desktop: Option<&Desktop>) -> ResultType> { #[inline] fn start_server(desktop: Option<&Desktop>, server: &mut Option) { + // should_start_server checked before force_stop_server() and the DRM greeter grace, so a + // sleep requested in between would otherwise still get a --server. + if is_system_preparing_for_sleep() { + return; + } match try_start_server_(desktop) { Ok(ps) => *server = ps, Err(err) => {