Skip to content

A modern terminal with a built-in multiplexer: close it and your sessions keep running. Run shells and tons of AI agents across your machines, then pick them up from desktop, browser, TUI and more. Written in Rust with no UI framework: interface drawn straight on the GPU. No Electron, GPUI or webview.

wezterm-client: let handshake lease state reach the attach; a proxied domain is not our socket

RoversX2ff6c9a95bed
diff --git a/wezterm-client/src/client.rs b/wezterm-client/src/client.rs
index 5478ff83..6bbe87e3 100644
--- a/wezterm-client/src/client.rs
+++ b/wezterm-client/src/client.rs
@@ -695,7 +695,10 @@ fn process_unilateral(
let domain = domain
.downcast_ref::<ClientDomain>()
.ok_or_else(|| anyhow!("domain {} is not a ClientDomain", local_domain_id))?;
- if domain.connection_generation() != Some(connection_generation) {
+ // Not the strict generation check of the other arms: this
+ // state is pushed right after the handshake, before the
+ // attach has built the inner that would carry a generation.
+ if !domain.accepts_connection_generation(connection_generation) {
return Ok(());
}
domain.process_remote_viewport_state(state);
@@ -716,7 +719,10 @@ fn process_unilateral(
let domain = domain
.downcast_ref::<ClientDomain>()
.ok_or_else(|| anyhow!("domain {} is not a ClientDomain", local_domain_id))?;
- if domain.connection_generation() != Some(connection_generation) {
+ // Not the strict generation check of the other arms: this
+ // state is pushed right after the handshake, before the
+ // attach has built the inner that would carry a generation.
+ if !domain.accepts_connection_generation(connection_generation) {
return Ok(());
}
domain.process_remote_access_state(state);
diff --git a/wezterm-client/src/domain.rs b/wezterm-client/src/domain.rs
index 60b8b845..19e8b117 100644
--- a/wezterm-client/src/domain.rs
+++ b/wezterm-client/src/domain.rs
@@ -1894,16 +1894,33 @@ pub(crate) fn deliver_thinkterm_session(
}
impl ClientDomain {
- /// The unix socket this domain connects to, if it is a unix domain.
- /// A mux server uses it to tell a client domain that leads back to its
- /// own socket from one that leads elsewhere.
+ /// The unix socket this domain connects to, if it is a unix domain
+ /// that connects to a socket at all. A mux server uses it to tell a
+ /// client domain that leads back to its own socket from one that leads
+ /// elsewhere. A domain that goes through a proxy command leads
+ /// wherever the proxy does; its configured socket path is not used and
+ /// defaults to the very path a server listens on.
pub fn unix_socket_path(&self) -> Option<std::path::PathBuf> {
match &self.config {
- ClientDomainConfig::Unix(unix) => Some(unix.socket_path()),
+ ClientDomainConfig::Unix(unix) if unix.proxy_command.is_none() => {
+ Some(unix.socket_path())
+ }
_ => None,
}
}
+ /// Whether a PDU from connection `generation` is for this domain as it
+ /// stands. While no inner exists (the first attach is in flight) there
+ /// is no generation to hold it against, and what the server pushes
+ /// during the handshake -- where the frontend lease stands -- is the
+ /// state the attach is waiting to keep.
+ pub fn accepts_connection_generation(&self, generation: u64) -> bool {
+ match self.connection_generation() {
+ Some(current) => current == generation,
+ None => true,
+ }
+ }
+
pub fn new(config: ClientDomainConfig) -> Self {
let local_domain_id = alloc_domain_id();
let label = config.label();