mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
Refact. Replace all tokio::time::interval() (#7173)
* Refact. Replace all `tokio::time::interval()` Signed-off-by: fufesou <shuanglongchen@yeah.net> * Refact Better min_interval for `ThrottledInterval`. Signed-off-by: fufesou <shuanglongchen@yeah.net> --------- Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -30,7 +30,7 @@ use hbb_common::{
|
||||
tokio::{
|
||||
self,
|
||||
sync::mpsc,
|
||||
time::{self, Duration, Instant, Interval},
|
||||
time::{self, Duration, Instant},
|
||||
},
|
||||
Stream,
|
||||
};
|
||||
@@ -62,7 +62,7 @@ pub struct Remote<T: InvokeUiSession> {
|
||||
read_jobs: Vec<fs::TransferJob>,
|
||||
write_jobs: Vec<fs::TransferJob>,
|
||||
remove_jobs: HashMap<i32, RemoveJob>,
|
||||
timer: Interval,
|
||||
timer: crate::RustDeskInterval,
|
||||
last_update_jobs_status: (Instant, HashMap<i32, u64>),
|
||||
is_connected: bool,
|
||||
first_frame: bool,
|
||||
@@ -99,7 +99,7 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
read_jobs: Vec::new(),
|
||||
write_jobs: Vec::new(),
|
||||
remove_jobs: Default::default(),
|
||||
timer: time::interval(SEC30),
|
||||
timer: crate::rustdesk_interval(time::interval(SEC30)),
|
||||
last_update_jobs_status: (Instant::now(), Default::default()),
|
||||
is_connected: false,
|
||||
first_frame: false,
|
||||
@@ -170,7 +170,7 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||
let mut rx_clip_client = rx_clip_client_lock.lock().await;
|
||||
|
||||
let mut status_timer = time::interval(Duration::new(1, 0));
|
||||
let mut status_timer = crate::rustdesk_interval(time::interval(Duration::new(1, 0)));
|
||||
let mut fps_instant = Instant::now();
|
||||
|
||||
loop {
|
||||
@@ -228,7 +228,7 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
}
|
||||
self.update_jobs_status();
|
||||
} else {
|
||||
self.timer = time::interval_at(Instant::now() + SEC30, SEC30);
|
||||
self.timer = crate::rustdesk_interval(time::interval_at(Instant::now() + SEC30, SEC30));
|
||||
}
|
||||
}
|
||||
_ = status_timer.tick() => {
|
||||
@@ -537,7 +537,7 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
}
|
||||
let total_size = job.total_size();
|
||||
self.read_jobs.push(job);
|
||||
self.timer = time::interval(MILLI1);
|
||||
self.timer = crate::rustdesk_interval(time::interval(MILLI1));
|
||||
allow_err!(
|
||||
peer.send(&fs::new_receive(id, to, file_num, files, total_size))
|
||||
.await
|
||||
@@ -597,7 +597,7 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
);
|
||||
job.is_last_job = true;
|
||||
self.read_jobs.push(job);
|
||||
self.timer = time::interval(MILLI1);
|
||||
self.timer = crate::rustdesk_interval(time::interval(MILLI1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user