This commit is contained in:
rustdesk
2024-07-14 05:47:42 +08:00
parent bed214bd37
commit d0a54a6cc6
6 changed files with 144 additions and 54 deletions

View File

@@ -21,11 +21,7 @@ use hbb_common::{
sleep,
socket_client::{self, connect_tcp, is_ipv4},
tcp::FramedStream,
tokio::{
self, select,
sync::Mutex,
time::{interval, Duration},
},
tokio::{self, select, sync::Mutex, time::interval},
udp::FramedSocket,
AddrMangle, IntoTargetAddr, ResultType, TargetAddr,
};
@@ -37,9 +33,6 @@ use crate::{
type Message = RendezvousMessage;
const TIMER_OUT: Duration = Duration::from_secs(1);
const DEFAULT_KEEP_ALIVE: i32 = 60_000;
lazy_static::lazy_static! {
static ref SOLVING_PK_MISMATCH: Arc<Mutex<String>> = Default::default();
}
@@ -151,10 +144,10 @@ impl RendezvousMediator {
addr: addr.clone(),
host: host.clone(),
host_prefix: Self::get_host_prefix(&host),
keep_alive: DEFAULT_KEEP_ALIVE,
keep_alive: crate::DEFAULT_KEEP_ALIVE,
};
let mut timer = crate::rustdesk_interval(interval(TIMER_OUT));
let mut timer = crate::rustdesk_interval(interval(crate::TIMER_OUT));
const MIN_REG_TIMEOUT: i64 = 3_000;
const MAX_REG_TIMEOUT: i64 = 30_000;
let mut reg_timeout = MIN_REG_TIMEOUT;
@@ -337,9 +330,9 @@ impl RendezvousMediator {
addr: conn.local_addr().into_target_addr()?,
host: host.clone(),
host_prefix: Self::get_host_prefix(&host),
keep_alive: DEFAULT_KEEP_ALIVE,
keep_alive: crate::DEFAULT_KEEP_ALIVE,
};
let mut timer = crate::rustdesk_interval(interval(TIMER_OUT));
let mut timer = crate::rustdesk_interval(interval(crate::TIMER_OUT));
let mut last_register_sent: Option<Instant> = None;
let mut last_recv_msg = Instant::now();
// we won't support connecting to multiple rendzvous servers any more, so we can use a global variable here.