From bcf08ba26d7adadb8a1f7777d3c173a334bbf357 Mon Sep 17 00:00:00 2001 From: fufesou Date: Wed, 29 Mar 2023 18:31:42 +0800 Subject: [PATCH] virtual display, linux, debug Signed-off-by: fufesou --- src/platform/linux.rs | 2 +- src/platform/linux_desktop_manager.rs | 35 +++------------------------ src/server/connection.rs | 3 --- 3 files changed, 4 insertions(+), 36 deletions(-) diff --git a/src/platform/linux.rs b/src/platform/linux.rs index b166f1531..8c4a68848 100644 --- a/src/platform/linux.rs +++ b/src/platform/linux.rs @@ -227,7 +227,7 @@ fn stop_rustdesk_servers() { #[inline] fn stop_xorg_subprocess() { - let _ = run_cmds(format!( + let _ = run_cmds(&format!( r##"ps -ef | grep '/etc/rustdesk/xorg.conf' | grep -v grep | awk '{{printf("kill -9 %d\n", $2)}}' | bash"##, )); } diff --git a/src/platform/linux_desktop_manager.rs b/src/platform/linux_desktop_manager.rs index ea7189b82..b21b2d5b1 100644 --- a/src/platform/linux_desktop_manager.rs +++ b/src/platform/linux_desktop_manager.rs @@ -111,7 +111,6 @@ impl DesktopManager { pub fn new() -> Self { let mut x11_username = "".to_owned(); let seat0_values = get_values_of_seat0(&[0, 1, 2]); - println!("REMOVE ME ======================== DesktopManager seato values {:?}", &seat0_values); if !seat0_values[0].is_empty() { if "x11" == get_display_server_of_session(&seat0_values[1]) { x11_username = seat0_values[2].clone(); @@ -427,10 +426,6 @@ impl DesktopManager { fn try_wait_x11_child_exit(child_xorg: &mut Child, child_wm: &mut Child) -> bool { match child_xorg.try_wait() { Ok(Some(status)) => { - println!( - "=============================MYDEBUG Xorg exit with {}", - status - ); log::info!("Xorg exit with {}", status); return true; } @@ -440,10 +435,7 @@ impl DesktopManager { match child_wm.try_wait() { Ok(Some(status)) => { - println!( - "=============================MYDEBUG: wm exit with {}", - status - ); + // Logout may result "wm exit with signal: 11 (SIGSEGV) (core dumped)" log::info!("wm exit with {}", status); return true; } @@ -460,20 +452,12 @@ impl DesktopManager { for _ in 0..2 { match child_xorg.try_wait() { Ok(Some(status)) => { - println!( - "=============================MYDEBUG Xorg exit with {}", - status - ); log::info!("Xorg exit with {}", status); exited = true; break; } Ok(None) => {} Err(e) => { - println!( - "=============================MYDEBUG Failed to wait xorg process, {}", - &e - ); log::error!("Failed to wait xorg process, {}", e); Self::fatal_exit(); } @@ -481,9 +465,6 @@ impl DesktopManager { std::thread::sleep(std::time::Duration::from_millis(1_000)); } if !exited { - println!( - "=============================MYDEBUG Failed to wait child xorg, after kill()" - ); log::error!("Failed to wait child xorg, after kill()"); // try kill -9? } @@ -494,19 +475,12 @@ impl DesktopManager { for _ in 0..2 { match child_wm.try_wait() { Ok(Some(status)) => { - println!( - "=============================MYDEBUG wm exit with {}", - status - ); + // Logout may result "wm exit with signal: 11 (SIGSEGV) (core dumped)" log::info!("wm exit with {}", status); exited = true; } Ok(None) => {} Err(e) => { - println!( - "=============================MYDEBUG Failed to wait wm process, {}", - &e - ); log::error!("Failed to wait wm process, {}", e); Self::fatal_exit(); } @@ -514,9 +488,6 @@ impl DesktopManager { std::thread::sleep(std::time::Duration::from_millis(1_000)); } if !exited { - println!( - "=============================MYDEBUG Failed to wait child xorg, after kill()" - ); log::error!("Failed to wait child xorg, after kill()"); // try kill -9? } @@ -533,7 +504,7 @@ impl DesktopManager { exited = Self::try_wait_x11_child_exit(child_xorg, child_wm); } if exited { - println!("=============================MYDEBUG begin to wait x11 children exit"); + log::debug!("Wait x11 children exiting"); Self::wait_x11_children_exit(child_xorg, child_wm); desktop_manager .is_child_running diff --git a/src/server/connection.rs b/src/server/connection.rs index beefaac1a..6bbbffefc 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -1075,7 +1075,6 @@ impl Connection { #[cfg(target_os = "linux")] if _username.is_empty() { let username = crate::platform::linux_desktop_manager::get_username(); - println!("REMOVE ME ===================================== try_start_desktop username '{}'", &username); if username.is_empty() { LOGIN_MSG_XSESSION_NOT_READY } else { @@ -1315,14 +1314,12 @@ impl Connection { } } else { if desktop_err.is_empty() { - println!("REMOVE ME =============================== send logon response"); self.send_logon_response().await; self.try_start_cm(lr.my_id, lr.my_name, true); if self.port_forward_socket.is_some() { return false; } } else { - println!("REMOVE ME =============================== send login error {}", &desktop_err); self.send_login_error(desktop_err).await; } }