From 8e9a42b7c0e67f9af0d7cf59a8a66bb243bb7c51 Mon Sep 17 00:00:00 2001 From: Thomas Wolf Date: Wed, 29 Dec 2021 20:11:04 +0100 Subject: 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 --- .../src/org/eclipse/jgit/transport/sshd/SshdSession.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'org.eclipse.jgit.ssh.apache/src/org') 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; -- cgit v1.2.3