mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-24 04:12:20 +08:00
revert test delay timeout to 1 sec since many deps on it, including
quality monitor, also change test delay with instant rather than systemtime, because instant is stable
This commit is contained in:
parent
36ed8f3f73
commit
f47faa548b
15
Cargo.lock
generated
15
Cargo.lock
generated
@ -299,6 +299,19 @@ dependencies = [
|
|||||||
"futures-core",
|
"futures-core",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-compression"
|
||||||
|
version = "0.4.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bc2d0cfb2a7388d34f590e76686704c494ed7aaceed62ee1ba35cbf363abc2a5"
|
||||||
|
dependencies = [
|
||||||
|
"flate2",
|
||||||
|
"futures-core",
|
||||||
|
"memchr",
|
||||||
|
"pin-project-lite",
|
||||||
|
"tokio",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "async-executor"
|
name = "async-executor"
|
||||||
version = "1.6.0"
|
version = "1.6.0"
|
||||||
@ -5064,6 +5077,7 @@ name = "reqwest"
|
|||||||
version = "0.11.18"
|
version = "0.11.18"
|
||||||
source = "git+https://github.com/rustdesk-org/reqwest#4cc834539d9c44f7b6bbc5d2f8805842dc5aa328"
|
source = "git+https://github.com/rustdesk-org/reqwest#4cc834539d9c44f7b6bbc5d2f8805842dc5aa328"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"async-compression",
|
||||||
"base64",
|
"base64",
|
||||||
"bytes",
|
"bytes",
|
||||||
"encoding_rs",
|
"encoding_rs",
|
||||||
@ -5088,6 +5102,7 @@ dependencies = [
|
|||||||
"serde_urlencoded",
|
"serde_urlencoded",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-rustls",
|
"tokio-rustls",
|
||||||
|
"tokio-util",
|
||||||
"tower-service",
|
"tower-service",
|
||||||
"url",
|
"url",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
|
@ -75,7 +75,7 @@ rdev = { git = "https://github.com/fufesou/rdev" }
|
|||||||
url = { version = "2.3", features = ["serde"] }
|
url = { version = "2.3", features = ["serde"] }
|
||||||
crossbeam-queue = "0.3"
|
crossbeam-queue = "0.3"
|
||||||
hex = "0.4"
|
hex = "0.4"
|
||||||
reqwest = { git = "https://github.com/rustdesk-org/reqwest", features = ["blocking", "json", "rustls-tls"], default-features=false }
|
reqwest = { git = "https://github.com/rustdesk-org/reqwest", features = ["blocking", "json", "rustls-tls", "gzip"], default-features=false }
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
cidr-utils = "0.5"
|
cidr-utils = "0.5"
|
||||||
libloading = "0.8"
|
libloading = "0.8"
|
||||||
|
@ -188,8 +188,8 @@ pub struct Connection {
|
|||||||
restart: bool,
|
restart: bool,
|
||||||
recording: bool,
|
recording: bool,
|
||||||
block_input: bool,
|
block_input: bool,
|
||||||
last_test_delay: i64,
|
last_test_delay: Option<Instant>,
|
||||||
network_delay: Option<u32>,
|
network_delay: u32,
|
||||||
lock_after_session_end: bool,
|
lock_after_session_end: bool,
|
||||||
show_remote_cursor: bool,
|
show_remote_cursor: bool,
|
||||||
// by peer
|
// by peer
|
||||||
@ -269,7 +269,7 @@ impl Subscriber for ConnInner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const TEST_DELAY_TIMEOUT: Duration = Duration::from_secs(3);
|
const TEST_DELAY_TIMEOUT: Duration = Duration::from_secs(1);
|
||||||
const SEC30: Duration = Duration::from_secs(30);
|
const SEC30: Duration = Duration::from_secs(30);
|
||||||
const H1: Duration = Duration::from_secs(3600);
|
const H1: Duration = Duration::from_secs(3600);
|
||||||
const MILLI1: Duration = Duration::from_millis(1);
|
const MILLI1: Duration = Duration::from_millis(1);
|
||||||
@ -335,8 +335,8 @@ impl Connection {
|
|||||||
restart: Connection::permission("enable-remote-restart"),
|
restart: Connection::permission("enable-remote-restart"),
|
||||||
recording: Connection::permission("enable-record-session"),
|
recording: Connection::permission("enable-record-session"),
|
||||||
block_input: Connection::permission("enable-block-input"),
|
block_input: Connection::permission("enable-block-input"),
|
||||||
last_test_delay: 0,
|
last_test_delay: None,
|
||||||
network_delay: None,
|
network_delay: 0,
|
||||||
lock_after_session_end: false,
|
lock_after_session_end: false,
|
||||||
show_remote_cursor: false,
|
show_remote_cursor: false,
|
||||||
ip: "".to_owned(),
|
ip: "".to_owned(),
|
||||||
@ -408,8 +408,7 @@ impl Connection {
|
|||||||
if !conn.block_input {
|
if !conn.block_input {
|
||||||
conn.send_permission(Permission::BlockInput, false).await;
|
conn.send_permission(Permission::BlockInput, false).await;
|
||||||
}
|
}
|
||||||
let mut test_delay_timer =
|
let mut test_delay_timer = time::interval(TEST_DELAY_TIMEOUT);
|
||||||
time::interval_at(Instant::now() + TEST_DELAY_TIMEOUT, TEST_DELAY_TIMEOUT);
|
|
||||||
let mut last_recv_time = Instant::now();
|
let mut last_recv_time = Instant::now();
|
||||||
|
|
||||||
conn.stream.set_send_timeout(
|
conn.stream.set_send_timeout(
|
||||||
@ -664,14 +663,12 @@ impl Connection {
|
|||||||
conn.on_close("Timeout", true).await;
|
conn.on_close("Timeout", true).await;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
let time = get_time();
|
|
||||||
let mut qos = video_service::VIDEO_QOS.lock().unwrap();
|
let mut qos = video_service::VIDEO_QOS.lock().unwrap();
|
||||||
if time > 0 && conn.last_test_delay == 0 {
|
if conn.last_test_delay.is_none() {
|
||||||
conn.last_test_delay = time;
|
conn.last_test_delay = Some(Instant::now());
|
||||||
let mut msg_out = Message::new();
|
let mut msg_out = Message::new();
|
||||||
msg_out.set_test_delay(TestDelay{
|
msg_out.set_test_delay(TestDelay{
|
||||||
time,
|
last_delay: conn.network_delay,
|
||||||
last_delay: conn.network_delay.unwrap_or_default(),
|
|
||||||
target_bitrate: qos.bitrate(),
|
target_bitrate: qos.bitrate(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
@ -1715,13 +1712,15 @@ impl Connection {
|
|||||||
msg_out.set_test_delay(t);
|
msg_out.set_test_delay(t);
|
||||||
self.inner.send(msg_out.into());
|
self.inner.send(msg_out.into());
|
||||||
} else {
|
} else {
|
||||||
self.last_test_delay = 0;
|
if let Some(tm) = self.last_test_delay {
|
||||||
let new_delay = (get_time() - t.time) as u32;
|
self.last_test_delay = None;
|
||||||
video_service::VIDEO_QOS
|
let new_delay = tm.elapsed().as_millis() as u32;
|
||||||
.lock()
|
video_service::VIDEO_QOS
|
||||||
.unwrap()
|
.lock()
|
||||||
.user_network_delay(self.inner.id(), new_delay);
|
.unwrap()
|
||||||
self.network_delay = Some(new_delay);
|
.user_network_delay(self.inner.id(), new_delay);
|
||||||
|
self.network_delay = new_delay;
|
||||||
|
}
|
||||||
self.delay_response_instant = Instant::now();
|
self.delay_response_instant = Instant::now();
|
||||||
}
|
}
|
||||||
} else if let Some(message::Union::SwitchSidesResponse(_s)) = msg.union {
|
} else if let Some(message::Union::SwitchSidesResponse(_s)) = msg.union {
|
||||||
|
Loading…
Reference in New Issue
Block a user