1
1
mirror of https://github.com/wez/wezterm.git synced 2025-01-04 11:42:53 +03:00

add some more diagnostics for mux connections

I suspect some race condition because adding these made the connect
time hang stop reproducing for me on my local network.

Will try this to the corp vpn.

refs: https://github.com/wez/wezterm/issues/127
This commit is contained in:
Wez Furlong 2020-02-02 15:02:30 -08:00
parent cb9ec2fa2a
commit 7257cf18c2
3 changed files with 19 additions and 9 deletions

View File

@ -128,8 +128,12 @@ fn client_thread(
next_serial += 1; next_serial += 1;
promises.insert(serial, promise); promises.insert(serial, promise);
pdu.encode(reconnectable.stream(), serial)?; pdu.encode(reconnectable.stream(), serial)
reconnectable.stream().flush()?; .context("encoding a PDU to send to the server")?;
reconnectable
.stream()
.flush()
.context("flushing PDU to server")?;
} }
}, },
Err(TryRecvError::Empty) => break, Err(TryRecvError::Empty) => break,
@ -166,7 +170,8 @@ fn client_thread(
Ok(Some(decoded)) => { Ok(Some(decoded)) => {
log::trace!("decoded serial {}", decoded.serial); log::trace!("decoded serial {}", decoded.serial);
if decoded.serial == 0 { if decoded.serial == 0 {
process_unilateral(local_domain_id, decoded)?; process_unilateral(local_domain_id, decoded)
.context("processing unilateral PDU from server")?;
} else if let Some(mut promise) = promises.remove(&decoded.serial) { } else if let Some(mut promise) = promises.remove(&decoded.serial) {
promise.result(Ok(decoded.pdu)); promise.result(Ok(decoded.pdu));
} else { } else {
@ -582,7 +587,7 @@ impl Reconnectable {
.configure()? .configure()?
.verify_hostname(!tls_client.accept_invalid_hostnames); .verify_hostname(!tls_client.accept_invalid_hostnames);
ui.output_str(&format!("Connecting to {}\n", remote_address)); ui.output_str(&format!("Connecting to {} using TLS\n", remote_address));
let stream = TcpStream::connect(remote_address) let stream = TcpStream::connect(remote_address)
.with_context(|| format!("connecting to {}", remote_address))?; .with_context(|| format!("connecting to {}", remote_address))?;
stream.set_nodelay(true)?; stream.set_nodelay(true)?;
@ -606,7 +611,7 @@ impl Reconnectable {
) )
})?, })?,
); );
ui.output_str("Connected!\n"); ui.output_str("TLS Connected!\n");
self.stream.replace(stream); self.stream.replace(stream);
Ok(()) Ok(())
} }

View File

@ -302,9 +302,14 @@ impl Domain for ClientDomain {
} }
}; };
ui.output_str("Version check OK! Requesting tab list...\n");
let tabs = client.list_tabs().await?; let tabs = client.list_tabs().await?;
ui.output_str(&format!(
"Server has {} tabs. Attaching to local UI...\n",
tabs.tabs.len()
));
ClientDomain::finish_attach(domain_id, client, tabs)?; ClientDomain::finish_attach(domain_id, client, tabs)?;
ui.output_str("Attached!\n");
drop(activity); drop(activity);
ui.close(); ui.close();
Ok(()) Ok(())

View File

@ -63,11 +63,11 @@ pub fn ssh_connect_with_ui(
} }
}; };
ui.output_str(&format!("Connecting to {}\n", remote_address)); ui.output_str(&format!("Connecting to {} using SSH\n", remote_address));
let tcp = TcpStream::connect(&remote_address) let tcp = TcpStream::connect(&remote_address)
.with_context(|| format!("ssh connecting to {}", remote_address))?; .with_context(|| format!("ssh connecting to {}", remote_address))?;
ui.output_str("Connected OK!\n"); ui.output_str("SSH: Connected OK!\n");
tcp.set_nodelay(true)?; tcp.set_nodelay(true)?;
sess.set_tcp_stream(tcp); sess.set_tcp_stream(tcp);
sess.handshake() sess.handshake()
@ -185,7 +185,7 @@ pub fn ssh_connect_with_ui(
"Password authentication for {}@{}\n", "Password authentication for {}@{}\n",
username, remote_address username, remote_address
)); ));
let pass = ui.password("Password: ")?; let pass = ui.password("🔐 Password: ")?;
if let Err(err) = sess.userauth_password(username, &pass) { if let Err(err) = sess.userauth_password(username, &pass) {
log::error!("while attempting password auth: {}", err); log::error!("while attempting password auth: {}", err);
} }