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.
This commit is contained in:
Wez Furlong committed 2020-02-22 19:26:25 -08:00
1 parent 4af4ad77b5
commit c9064c3f90
1 file changed
+13 -6
+13 -6
View File
@@ -469,12 +469,19 @@ impl Reconnectable {
return Ok(());
}
Err(err) => {
if err.root_cause().downcast_ref::<std::io::Error>().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::<std::io::Error>() {
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",