From 49300deeb1642a3ed5025b2020ea68234b2eaddf Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 31 Oct 2026 22:46:39 +0000 Subject: [PATCH] Send the client keepalive every 5 seconds The C3X's login records show the app's shell sessions ending exactly 10 seconds after they start, which is its sshd's ClientAliveInterval: the session ends when the server's first keepalive probe is due. A client keepalive every 5 seconds means the server always sees traffic and never sends that probe. Six missed replies (30 seconds) still end a dead session. Claude-Session: https://claude.ai/code/session_01CiTeuL5wrBa86ELAzASv4B --- .../main/kotlin/com/secrm/core/ssh/SshClientManager.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/ssh/src/main/kotlin/com/secrm/core/ssh/SshClientManager.kt b/core/ssh/src/main/kotlin/com/secrm/core/ssh/SshClientManager.kt index ef5948c..48bad36 100644 --- a/core/ssh/src/main/kotlin/com/secrm/core/ssh/SshClientManager.kt +++ b/core/ssh/src/main/kotlin/com/secrm/core/ssh/SshClientManager.kt @@ -294,9 +294,11 @@ class SshClientManager { }) }) if (cfg.auth is SshAuth.Password) s.setPassword((cfg.auth as SshAuth.Password).password) - // Probes the link every 15 s; three missed replies end the session, so a drop is noticed. - s.setServerAliveInterval(15_000) - s.setServerAliveCountMax(3) + // Probes the link every 5 s; six missed replies (30 s) end the session, so a drop is noticed. Under 10 s so a + // server with ClientAliveInterval 10 (the C3X) always sees traffic and never sends its own probe: the + // shell sessions there ended exactly when that first probe was due. + s.setServerAliveInterval(5_000) + s.setServerAliveCountMax(6) try { s.connect(if (cfg.via != null) maxOf(cfg.connectTimeoutMs, 30_000) else cfg.connectTimeoutMs) } catch (t: Throwable) { val presented = s.hostKey?.key