Merge pull request #18046 from iterate-ch/bugfix/GH-18045

Enable heartbeat
This commit is contained in:
David Kocher
2026-05-06 13:33:38 +02:00
committed by GitHub
2 changed files with 3 additions and 3 deletions
@@ -654,7 +654,7 @@ ssh.authentication.publickey.default.rsa=~/.ssh/id_rsa
ssh.authentication.publickey.default.dsa=~/.ssh/id_dsa
ssh.authentication.agent.enable=true
ssh.heartbeat.provider=keep-alive
ssh.heartbeat.provider=heartbeat
ssh.heartbeat.seconds=60
# Enable ZLIB compression
@@ -158,8 +158,6 @@ public class SFTPSession extends Session<SSHClient> {
else {
connection.connect(new OpenSSHHostnameConfigurator().getHostname(host.getHostname()), host.getPort());
}
final KeepAlive keepalive = connection.getConnection().getKeepAlive();
keepalive.setKeepAliveInterval(preferences.getInteger("ssh.heartbeat.seconds"));
return connection;
}
catch(IOException e) {
@@ -169,6 +167,8 @@ public class SFTPSession extends Session<SSHClient> {
private SSHClient toClient(final HostKeyCallback key, final Config configuration) {
final SSHClient connection = new SSHClient(configuration);
final KeepAlive keepalive = connection.getConnection().getKeepAlive();
keepalive.setKeepAliveInterval(preferences.getInteger("ssh.heartbeat.seconds"));
final int timeout = ConnectionTimeoutFactory.get(preferences).getTimeout() * 1000;
connection.getTransport().setTimeoutMs(timeout);
connection.setTimeout(timeout);