| @@ -55,6 +55,7 @@ pub struct SshConnectionOptions { · 54 unmodified lines |
| 55 | 55 | pub password: Option<String>, |
| 56 | 56 | pub args: Option<Vec<String>>, |
| 57 | 57 | pub port_forwards: Option<Vec<SshPortForwardOption>>, |
| 58 | + pub connection_timeout: Option<u16>, |
| 58 | 59 | |
| 59 | 60 | pub nickname: Option<String>, |
| 60 | 61 | pub upload_binary_over_ssh: bool, |
| @@ -71,6 +72,7 @@ impl From<settings::SshConnection> for SshConnectionOptions { · 10 unmodified lines |
| 71 | 72 | nickname: val.nickname, |
| 72 | 73 | upload_binary_over_ssh: val.upload_binary_over_ssh.unwrap_or_default(), |
| 73 | 74 | port_forwards: val.port_forwards, |
| 75 | + connection_timeout: val.connection_timeout, |
| 74 | 76 | } |
| 75 | 77 | } |
| 76 | 78 | } |
| @@ -670,7 +672,12 @@ impl SshRemoteConnection { · 593 unmodified lines |
| 670 | 672 | |
| 671 | 673 | delegate.set_status(Some("Downloading remote development server on host"), cx); |
| 672 | 674 | |
| 673 | | − const CONNECT_TIMEOUT_SECS: &str = "10"; |
| 675 | + let connection_timeout = self |
| 676 | + .socket |
| 677 | + .connection_options |
| 678 | + .connection_timeout |
| 679 | + .unwrap_or(10) |
| 680 | + .to_string(); |
| 674 | 681 | |
| 675 | 682 | match self |
| 676 | 683 | .socket |
| @@ -681,7 +688,7 @@ impl SshRemoteConnection { · 4 unmodified lines |
| 681 | 688 | "-f", |
| 682 | 689 | "-L", |
| 683 | 690 | "--connect-timeout", |
| 684 | | − CONNECT_TIMEOUT_SECS, |
| 691 | + &connection_timeout, |
| 685 | 692 | url, |
| 686 | 693 | "-o", |
| 687 | 694 | &tmp_path_gz.display(self.path_style()), |
| @@ -709,7 +716,7 @@ impl SshRemoteConnection { · 21 unmodified lines |
| 709 | 716 | "wget", |
| 710 | 717 | &[ |
| 711 | 718 | "--connect-timeout", |
| 712 | | − CONNECT_TIMEOUT_SECS, |
| 719 | + &connection_timeout, |
| 713 | 720 | "--tries", |
| 714 | 721 | "1", |
| 715 | 722 | url, |
| @@ -1226,6 +1233,7 @@ impl SshConnectionOptions { · 510 unmodified lines |
| 1226 | 1233 | password: None, |
| 1227 | 1234 | nickname: None, |
| 1228 | 1235 | upload_binary_over_ssh: false, |
| 1236 | + connection_timeout: None, |
| 1229 | 1237 | }) |
| 1230 | 1238 | } |
| 1231 | 1239 | |
| @@ -1252,6 +1260,10 @@ impl SshConnectionOptions { · 20 unmodified lines |
| 1252 | 1260 | pub fn additional_args(&self) -> Vec<String> { |
| 1253 | 1261 | let mut args = self.additional_args_for_scp(); |
| 1254 | 1262 | |
| 1263 | + if let Some(timeout) = self.connection_timeout { |
| 1264 | + args.extend(["-o".to_string(), format!("ConnectTimeout={}", timeout)]); |
| 1265 | + } |
| 1266 | + |
| 1255 | 1267 | if let Some(forwards) = &self.port_forwards { |
| 1256 | 1268 | args.extend(forwards.iter().map(|pf| { |
| 1257 | 1269 | let local_host = match &pf.local_host { |