From c9064c3f904c3d0e7edfbba0aa38f779cc28795e Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 22 Feb 2020 19:26:25 -0800 Subject: [PATCH] mux: don't give up tls connection for connrefused When we're trying to use credentials from a session that was previously bootstrapped via ssh but hit connection refused (eg: the server was subsequently shut down), then we want to proceed to attempting to re-boostrap via ssh. --- src/server/client.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/server/client.rs b/src/server/client.rs index f140a6cf8..64981359c 100644 --- a/src/server/client.rs +++ b/src/server/client.rs @@ -469,12 +469,19 @@ impl Reconnectable { return Ok(()); } Err(err) => { - if err.root_cause().downcast_ref::().is_some() { - // If it is an IO error that implies that we had an issue - // reaching or otherwise talking to the remote host. - // Re-attempting the SSH bootstrap most likely will not - // succeed so we let this bubble up. - return Err(err); + if let Some(ioerr) = err.root_cause().downcast_ref::() { + match ioerr.kind() { + std::io::ErrorKind::ConnectionRefused => { + // Server isn't up yet; let's proceed with bootstrap + } + _ => { + // If it is an IO error that implies that we had an issue + // reaching or otherwise talking to the remote host. + // Re-attempting the SSH bootstrap most likely will not + // succeed so we let this bubble up. + return Err(err); + } + } } ui.output_str(&format!( "Failed to reuse creds: {:?}\nWill retry bootstrap via SSH\n",