summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.ssh.apache/src/org
diff options
context:
space:
mode:
authorThomas Wolf <thomas.wolf@paranor.ch>2021-12-29 20:11:04 +0100
committerThomas Wolf <thomas.wolf@paranor.ch>2022-01-30 17:13:47 +0100
commit8e9a42b7c0e67f9af0d7cf59a8a66bb243bb7c51 (patch)
tree73ad78401b4623c1379dbaf4810233bb590a5920 /org.eclipse.jgit.ssh.apache/src/org
parentf41929708e79d7b36e0a653ae3d7464d4f20b606 (diff)
downloadjgit-8e9a42b7c0e67f9af0d7cf59a8a66bb243bb7c51.tar.gz
jgit-8e9a42b7c0e67f9af0d7cf59a8a66bb243bb7c51.zip
sshd: support the ConnectTimeout ssh config
Parse the value from the ssh config and if set use it when connecting. Change-Id: I85b44c9468a5027602375706612c46ea7a99b2bd Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit.ssh.apache/src/org')
-rw-r--r--org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/SshdSession.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/SshdSession.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/SshdSession.java
index c270b44956..b742f5ea42 100644
--- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/SshdSession.java
+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/SshdSession.java
@@ -51,6 +51,7 @@ import org.apache.sshd.sftp.client.SftpClientFactory;
import org.apache.sshd.sftp.common.SftpException;
import org.eclipse.jgit.annotations.NonNull;
import org.eclipse.jgit.errors.TransportException;
+import org.eclipse.jgit.internal.transport.ssh.OpenSshConfigFile;
import org.eclipse.jgit.internal.transport.sshd.JGitSshClient;
import org.eclipse.jgit.internal.transport.sshd.SshdText;
import org.eclipse.jgit.transport.FtpChannel;
@@ -138,7 +139,11 @@ public class SshdSession implements RemoteSession2 {
JGitSshClient.LOCAL_FORWARD_ADDRESS,
portForward.getBoundAddress());
}
- resultSession = connect(hostConfig, context, timeout);
+ int timeoutInSec = OpenSshConfigFile.timeSpec(
+ hostConfig.getProperty(SshConstants.CONNECT_TIMEOUT));
+ resultSession = connect(hostConfig, context,
+ timeoutInSec > 0 ? Duration.ofSeconds(timeoutInSec)
+ : timeout);
if (proxySession != null) {
final PortForwardingTracker tracker = portForward;
final ClientSession pSession = proxySession;