From de485ca3a494bdc905555384cc40e894a884e79a Mon Sep 17 00:00:00 2001 From: fufesou Date: Sat, 1 Apr 2023 10:57:40 +0800 Subject: [PATCH] remove wait prelogin in service Signed-off-by: fufesou --- libs/hbb_common/src/platform/linux.rs | 6 ------ src/server/service.rs | 18 ------------------ 2 files changed, 24 deletions(-) diff --git a/libs/hbb_common/src/platform/linux.rs b/libs/hbb_common/src/platform/linux.rs index 4da6d7436..89c96799d 100644 --- a/libs/hbb_common/src/platform/linux.rs +++ b/libs/hbb_common/src/platform/linux.rs @@ -40,12 +40,6 @@ pub fn is_desktop_wayland() -> bool { get_display_server() == DISPLAY_SERVER_WAYLAND } -#[inline] -pub fn is_x11_wayland() -> bool { - let ds = get_display_server(); - ds == DISPLAY_SERVER_X11 || ds == DISPLAY_SERVER_WAYLAND -} - #[inline] pub fn is_x11_or_headless() -> bool { !is_desktop_wayland() diff --git a/src/server/service.rs b/src/server/service.rs index fbe21105d..9cc1e860c 100644 --- a/src/server/service.rs +++ b/src/server/service.rs @@ -189,20 +189,6 @@ impl> ServiceTmpl { } } - #[inline] - fn wait_prelogin_or_x11gdm(&self) { - #[cfg(target_os = "linux")] - while self.active() { - if crate::platform::linux::is_prelogin() { - break; - } - if crate::platform::linux::is_x11_wayland() { - break; - } - thread::sleep(time::Duration::from_millis(300)); - } - } - pub fn repeat(&self, interval_ms: u64, callback: F) where F: 'static + FnMut(Self, &mut S) -> ResultType<()> + Send, @@ -212,8 +198,6 @@ impl> ServiceTmpl { let mut callback = callback; let sp = self.clone(); let thread = thread::spawn(move || { - sp.wait_prelogin_or_x11gdm(); - let mut state = S::default(); let mut may_reset = false; while sp.active() { @@ -248,8 +232,6 @@ impl> ServiceTmpl { let sp = self.clone(); let mut callback = callback; let thread = thread::spawn(move || { - sp.wait_prelogin_or_x11gdm(); - let mut error_timeout = HIBERNATE_TIMEOUT; while sp.active() { if sp.has_subscribes() {