From c80cb73ce56e994230d0d9fcfe475756f9027641 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sun, 13 Jun 2021 08:18:51 -0700 Subject: [PATCH] mux client: disable prediction for unix connections refs: #817 --- wezterm-client/src/client.rs | 7 +++++++ wezterm-client/src/domain.rs | 4 ++++ wezterm-client/src/pane/renderable.rs | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/wezterm-client/src/client.rs b/wezterm-client/src/client.rs index 875b478c3..979402e54 100644 --- a/wezterm-client/src/client.rs +++ b/wezterm-client/src/client.rs @@ -41,6 +41,7 @@ pub struct Client { sender: Sender, local_domain_id: DomainId, pub is_reconnectable: bool, + pub is_local: bool, } #[derive(Error, Debug, Clone, PartialEq, Eq)] @@ -381,6 +382,10 @@ impl Reconnectable { self.stream.take() } + fn is_local(&mut self) -> bool { + matches!(&self.config, ClientDomainConfig::Unix(_)) + } + fn reconnectable(&mut self) -> bool { match &self.config { // It doesn't make sense to reconnect to a unix socket; we only @@ -784,6 +789,7 @@ impl Reconnectable { impl Client { fn new(local_domain_id: DomainId, mut reconnectable: Reconnectable) -> Self { let is_reconnectable = reconnectable.reconnectable(); + let is_local = reconnectable.is_local(); let (sender, mut receiver) = unbounded(); thread::spawn(move || { @@ -870,6 +876,7 @@ impl Client { sender, local_domain_id, is_reconnectable, + is_local, } } diff --git a/wezterm-client/src/domain.rs b/wezterm-client/src/domain.rs index 13b2b80e0..60f137e35 100644 --- a/wezterm-client/src/domain.rs +++ b/wezterm-client/src/domain.rs @@ -106,6 +106,10 @@ impl ClientInner { } None } + + pub fn is_local(&self) -> bool { + self.client.is_local + } } #[derive(Clone, Debug)] diff --git a/wezterm-client/src/pane/renderable.rs b/wezterm-client/src/pane/renderable.rs index 02b6dde41..89450e7ec 100644 --- a/wezterm-client/src/pane/renderable.rs +++ b/wezterm-client/src/pane/renderable.rs @@ -133,7 +133,7 @@ impl RenderableInner { /// so we only employ it when it looks like the latency is high. /// We pick 100ms as the threshold for this. fn should_predict(&self) -> bool { - self.last_input_rtt >= 100 + !self.client.is_local() && self.last_input_rtt >= 100 } /// Compute a "prediction" and apply it to the line data that we