fix: 修复ssh_config中Host存在其他字符时第一次连接失败

This commit is contained in:
Kairlec
2025-01-06 10:25:21 +08:00
committed by hstyi
parent 89fa153c1e
commit 7f40a67c28

View File

@@ -20,6 +20,7 @@ import java.net.InetSocketAddress
import java.net.Proxy
import java.time.Duration
import kotlin.math.max
import org.apache.sshd.client.config.hosts.HostConfigEntryResolver
object SshClients {
private val timeout = Duration.ofSeconds(30)
@@ -83,6 +84,8 @@ object SshClients {
builder.forwardingFilter(AcceptAllForwardingFilter.INSTANCE)
}
builder.hostConfigEntryResolver(HostConfigEntryResolver.EMPTY)
val sshClient = builder.build() as JGitSshClient
val heartbeatInterval = max(host.options.heartbeatInterval, 3)
CoreModuleProperties.HEARTBEAT_INTERVAL.set(sshClient, Duration.ofSeconds(heartbeatInterval.toLong()))