Sets default connection attempt to 1 in config-server (#2175)

This commit is contained in:
Kaveh Shamsi
2022-10-07 14:37:20 +02:00
committed by GitHub
parent 3ad94bf0ce
commit fc97f88e07
2 changed files with 2 additions and 3 deletions

View File

@@ -89,6 +89,7 @@ public class PropertyBasedSshSessionFactory extends SshdSessionFactory {
hostEntry.setValue(SshConstants.PORT,
Integer.toString(port > 0 ? port : SshConstants.SSH_DEFAULT_PORT));
hostEntry.setValue(SshConstants.USER, userName);
hostEntry.setValue(SshConstants.CONNECTION_ATTEMPTS, "1");
return updateIfNeeded(hostEntry, hostName);
}
@@ -231,9 +232,6 @@ public class PropertyBasedSshSessionFactory extends SshdSessionFactory {
@Override
public ProxyData get(InetSocketAddress remoteAddress) {
JGitEnvironmentProperties sshProperties = findEnvironmentProperties(sshKeysByHostname, remoteAddress);
if (sshProperties == null) {
return null;
}
ProxyHostProperties proxyHostProperties = sshProperties.getProxy()
.get(ProxyHostProperties.ProxyForScheme.HTTP);

View File

@@ -286,6 +286,7 @@ public class PropertyBasedSshSessionFactoryTest {
assertThat(sshConfig.getValue("HostName")).isEqualTo("gitlab.example.local");
assertThat(sshConfig.getValue("Port")).isEqualTo("123");
assertThat(sshConfig.getValue("User")).isEqualTo("user.name");
assertThat(sshConfig.getValue("ConnectionAttempts")).isEqualTo("1");
}
@Test