rustdesk 2024-06-09 19:48:42 +08:00
parent 57570c3ba6
commit 78d7bfac01

View File

@ -71,12 +71,15 @@ async fn start_hbbs_sync_async() {
continue; continue;
} }
let conns = Connection::alive_conns(); let conns = Connection::alive_conns();
if info_uploaded.0 && (url != info_uploaded.1 || id != info_uploaded.3){ if info_uploaded.0 && (url != info_uploaded.1 || id != info_uploaded.3) {
info_uploaded.0 = false; info_uploaded.0 = false;
*PRO.lock().unwrap() = false; *PRO.lock().unwrap() = false;
} }
if !info_uploaded.0 && info_uploaded.2.map(|x| x.elapsed() >= UPLOAD_SYSINFO_TIMEOUT).unwrap_or(true){ if !info_uploaded.0 && info_uploaded.2.map(|x| x.elapsed() >= UPLOAD_SYSINFO_TIMEOUT).unwrap_or(true) {
let mut v = crate::get_sysinfo(); let mut v = crate::get_sysinfo();
// username is empty in login screen of windows, but here we only upload sysinfo once, causing
// real user name not uploaded after login screen. https://github.com/rustdesk/rustdesk/discussions/8031
if !cfg!(windows) || !v["username"].as_str().unwrap_or_default().is_empty() {
v["version"] = json!(crate::VERSION); v["version"] = json!(crate::VERSION);
v["id"] = json!(id); v["id"] = json!(id);
v["uuid"] = json!(crate::encode64(hbb_common::get_uuid())); v["uuid"] = json!(crate::encode64(hbb_common::get_uuid()));
@ -105,7 +108,8 @@ async fn start_hbbs_sync_async() {
} }
} }
} }
if conns.is_empty() && last_sent.map(|x| x.elapsed() < TIME_HEARTBEAT).unwrap_or(false){ }
if conns.is_empty() && last_sent.map(|x| x.elapsed() < TIME_HEARTBEAT).unwrap_or(false) {
continue; continue;
} }
last_sent = Some(Instant::now()); last_sent = Some(Instant::now());