prepare device_info upload, change sync interval from 30s to 15s, also

enable android
This commit is contained in:
rustdesk 2023-07-19 21:46:15 +08:00
parent c9d19115e9
commit e48f36a227
3 changed files with 4 additions and 4 deletions

View File

@ -9,7 +9,7 @@ use hbb_common::{
use serde::{Deserialize, Serialize};
use serde_json::{json, Value};
const TIME_HEARTBEAT: Duration = Duration::from_secs(30);
const TIME_HEARTBEAT: Duration = Duration::from_secs(15);
const TIME_CONN: Duration = Duration::from_secs(3);
#[cfg(not(any(target_os = "ios")))]
@ -17,7 +17,7 @@ lazy_static::lazy_static! {
static ref SENDER : Mutex<broadcast::Sender<Vec<i32>>> = Mutex::new(start_hbbs_sync());
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
#[cfg(not(any(target_os = "ios")))]
pub fn start() {
let _sender = SENDER.lock().unwrap();
}
@ -52,7 +52,6 @@ async fn start_hbbs_sync_async() {
tokio::select! {
_ = interval.tick() => {
let url = heartbeat_url();
let modified_at = LocalConfig::get_option("strategy_timestamp").parse::<i64>().unwrap_or(0);
if !url.is_empty() {
let conns = Connection::alive_conns();
if conns.is_empty() && last_send.elapsed() < TIME_HEARTBEAT {
@ -65,6 +64,7 @@ async fn start_hbbs_sync_async() {
if !conns.is_empty() {
v["conns"] = json!(conns);
}
let modified_at = LocalConfig::get_option("strategy_timestamp").parse::<i64>().unwrap_or(0);
v["modified_at"] = json!(modified_at);
if let Ok(s) = crate::post_request(url.clone(), v.to_string(), "").await {
if let Ok(mut rsp) = serde_json::from_str::<HashMap::<&str, Value>>(&s) {

View File

@ -52,6 +52,7 @@ impl RendezvousMediator {
}
pub async fn start_all() {
crate::hbbs_http::sync::start();
let mut nat_tested = false;
check_zombie();
let server = new_server();

View File

@ -380,7 +380,6 @@ pub async fn start_server(is_server: bool) {
}
});
input_service::fix_key_down_timeout_loop();
crate::hbbs_http::sync::start();
#[cfg(target_os = "linux")]
if crate::platform::current_is_wayland() {
allow_err!(input_service::setup_uinput(0, 1920, 0, 1080).await);