remove psutil which is too old

This commit is contained in:
rustdesk
2022-01-15 13:47:57 +08:00
parent d069b73303
commit f47dcd1a8b
6 changed files with 157 additions and 88 deletions

View File

@@ -298,16 +298,16 @@ fn get_pid_file(postfix: &str) -> String {
#[cfg(not(windows))]
async fn check_pid(postfix: &str) {
use hbb_common::sysinfo::ProcessExt;
let pid_file = get_pid_file(postfix);
if let Ok(mut file) = File::open(&pid_file) {
let mut content = String::new();
file.read_to_string(&mut content).ok();
let pid = content.parse::<i32>().unwrap_or(0);
if pid > 0 {
if let Ok(p) = psutil::process::Process::new(pid as _) {
if let Ok(current) = psutil::process::Process::current() {
if current.name().unwrap_or("".to_owned()) == p.name().unwrap_or("".to_owned())
{
if let Some(p) = hbb_common::get_process(pid) {
if let Some(current) = hbb_common::get_current_process() {
if current.name() == p.name() {
// double check with connect
if connect(1000, postfix).await.is_ok() {
return;

View File

@@ -275,18 +275,6 @@ pub async fn start_server(is_server: bool, _tray: bool) {
log::info!("XAUTHORITY={:?}", std::env::var("XAUTHORITY"));
}
#[cfg(target_os = "macos")]
{
loop {
if crate::platform::macos::is_installed_daemon(false) {
break;
}
sleep(1.0).await;
}
sync_and_watch_config_dir().await;
}
if is_server {
std::thread::spawn(move || {
if let Err(err) = crate::ipc::start("") {
@@ -295,6 +283,8 @@ pub async fn start_server(is_server: bool, _tray: bool) {
}
});
input_service::fix_key_down_timeout_loop();
#[cfg(target_os = "macos")]
tokio::spawn(async { sync_and_watch_config_dir().await });
crate::RendezvousMediator::start_all().await;
} else {
match crate::ipc::connect(1000, "").await {