smaller timeout for android and self-hosting
This commit is contained in:
parent
e942c80afb
commit
964c2ed2b5
@ -1531,7 +1531,7 @@ impl LoginConfigHandler {
|
||||
} else if q == "custom" {
|
||||
let config = self.load_config();
|
||||
let allow_more =
|
||||
!crate::ui_interface::using_public_server() || self.direct == Some(true);
|
||||
!crate::using_public_server() || self.direct == Some(true);
|
||||
let quality = if config.custom_image_quality.is_empty() {
|
||||
50
|
||||
} else {
|
||||
|
@ -1328,3 +1328,10 @@ pub fn create_symmetric_key_msg(their_pk_b: [u8; 32]) -> (Bytes, Bytes, secretbo
|
||||
let sealed_key = box_::seal(&key.0, &nonce, &their_pk_b, &out_sk_b);
|
||||
(Vec::from(our_pk_b.0).into(), sealed_key.into(), key)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn using_public_server() -> bool {
|
||||
option_env!("RENDEZVOUS_SERVER").unwrap_or("").is_empty()
|
||||
&& crate::get_custom_rendezvous_server(get_option("custom-rendezvous-server")).is_empty()
|
||||
}
|
||||
|
||||
|
@ -222,8 +222,12 @@ impl RendezvousMediator {
|
||||
last_timer = now;
|
||||
let expired = last_register_resp.map(|x| x.elapsed().as_millis() as i64 >= REG_INTERVAL).unwrap_or(true);
|
||||
let timeout = last_register_sent.map(|x| x.elapsed().as_millis() as i64 >= reg_timeout).unwrap_or(false);
|
||||
if timeout && reg_timeout < MAX_REG_TIMEOUT {
|
||||
reg_timeout += MIN_REG_TIMEOUT;
|
||||
// temporarily disable exponential backoff for android before we add wakeup trigger to force connect in android
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
if crate::using_public_server() { // only turn on this for public server, may help DDNS self-hosting user.
|
||||
if timeout && reg_timeout < MAX_REG_TIMEOUT {
|
||||
reg_timeout += MIN_REG_TIMEOUT;
|
||||
}
|
||||
}
|
||||
if timeout || (last_register_sent.is_none() && expired) {
|
||||
if timeout {
|
||||
|
@ -259,7 +259,7 @@ impl UI {
|
||||
}
|
||||
|
||||
fn using_public_server(&self) -> bool {
|
||||
using_public_server()
|
||||
crate::using_public_server()
|
||||
}
|
||||
|
||||
fn get_options(&self) -> Value {
|
||||
|
@ -248,12 +248,6 @@ pub fn set_peer_option(id: String, name: String, value: String) {
|
||||
c.store(&id);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn using_public_server() -> bool {
|
||||
option_env!("RENDEZVOUS_SERVER").unwrap_or("").is_empty()
|
||||
&& crate::get_custom_rendezvous_server(get_option("custom-rendezvous-server")).is_empty()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_options() -> String {
|
||||
let options = {
|
||||
@ -1114,11 +1108,10 @@ async fn check_connect_status_(reconnect: bool, rx: mpsc::UnboundedReceiver<ipc:
|
||||
allow_err!(c.send(&data).await);
|
||||
}
|
||||
_ = timer.tick() => {
|
||||
let now = time::Instant::now();
|
||||
if last_timer.elapsed() < TIMER_OUT {
|
||||
continue;
|
||||
}
|
||||
last_timer = now;
|
||||
last_timer = time::Instant::now();
|
||||
|
||||
c.send(&ipc::Data::OnlineStatus(None)).await.ok();
|
||||
c.send(&ipc::Data::Options(None)).await.ok();
|
||||
|
Loading…
x
Reference in New Issue
Block a user