mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-02-17 14:07:28 +08:00
try to fix reboot not working because retry too slow
This commit is contained in:
@@ -93,6 +93,7 @@ impl RendezvousMediator {
|
||||
}
|
||||
scrap::codec::test_av1();
|
||||
loop {
|
||||
let mut timeout = CONNECT_TIMEOUT;
|
||||
let conn_start_time = Instant::now();
|
||||
*SOLVING_PK_MISMATCH.lock().await = "".to_owned();
|
||||
if !config::option2bool("stop-service", &Config::get_option("stop-service"))
|
||||
@@ -106,7 +107,15 @@ impl RendezvousMediator {
|
||||
let server = server.clone();
|
||||
futs.push(tokio::spawn(async move {
|
||||
if let Err(err) = Self::start(server, host).await {
|
||||
log::error!("rendezvous mediator error: {err}");
|
||||
let err = format!("rendezvous mediator error: {err}");
|
||||
// When user reboot, there might be below error, waiting too long
|
||||
// (CONNECT_TIMEOUT 18s) will make user think there is bug
|
||||
if err.contains("10054") || err.contains("11001") {
|
||||
// No such host is known. (os error 11001)
|
||||
// An existing connection was forcibly closed by the remote host. (os error 10054): also happens for UDP
|
||||
timeout = 3000;
|
||||
}
|
||||
log::error!("{err}");
|
||||
}
|
||||
// SHOULD_EXIT here is to ensure once one exits, the others also exit.
|
||||
SHOULD_EXIT.store(true, Ordering::SeqCst);
|
||||
@@ -119,8 +128,8 @@ impl RendezvousMediator {
|
||||
Config::reset_online();
|
||||
if !MANUAL_RESTARTED.load(Ordering::SeqCst) {
|
||||
let elapsed = conn_start_time.elapsed().as_millis() as u64;
|
||||
if elapsed < CONNECT_TIMEOUT {
|
||||
sleep(((CONNECT_TIMEOUT - elapsed) / 1000) as _).await;
|
||||
if elapsed < timeout{
|
||||
sleep(((timeout - elapsed) / 1000) as _).await;
|
||||
}
|
||||
} else {
|
||||
// https://github.com/rustdesk/rustdesk/issues/12233
|
||||
@@ -204,7 +213,7 @@ impl RendezvousMediator {
|
||||
log::debug!("Non-protobuf message bytes received: {:?}", bytes);
|
||||
}
|
||||
},
|
||||
Some(Err(e)) => bail!("Failed to receive next {}", e), // maybe socks5 tcp disconnected
|
||||
Some(Err(e)) => bail!("Failed to receive next: {}", e), // maybe socks5 tcp disconnected
|
||||
None => {
|
||||
bail!("Socket receive none. Maybe socks5 server is down.");
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user