From aa1476fc13aa7ec75621a3af60815b7eec94e063 Mon Sep 17 00:00:00 2001 From: Wesley Reid Date: Tue, 16 Dec 2025 23:27:53 -0500 Subject: [PATCH] Remove PTY-level keepalive (#449) * Add termix.rb Cask file * Update Termix to version 1.9.0 with new checksum * Update README to remove 'coming soon' notes * Remove PTY-level keepalive to prevent unwanted terminal output; use SSH-level keepalive instead --------- Co-authored-by: Luke Gustafson <88517757+LukeGus@users.noreply.github.com> --- src/backend/ssh/terminal.ts | 36 ++++++++---------------------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/src/backend/ssh/terminal.ts b/src/backend/ssh/terminal.ts index 78c181e7..9b863824 100644 --- a/src/backend/ssh/terminal.ts +++ b/src/backend/ssh/terminal.ts @@ -316,7 +316,6 @@ wss.on("connection", async (ws: WebSocket, req) => { let sshConn: Client | null = null; let sshStream: ClientChannel | null = null; - let pingInterval: NodeJS.Timeout | null = null; let keyboardInteractiveFinish: ((responses: string[]) => void) | null = null; let totpPromptSent = false; let isKeyboardInteractive = false; @@ -802,8 +801,6 @@ wss.on("connection", async (ws: WebSocket, req) => { ); }); - setupPingInterval(); - if (initialPath && initialPath.trim() !== "") { const cdCommand = `cd "${initialPath.replace(/"/g, '\\"')}" && pwd\n`; stream.write(cdCommand); @@ -1279,11 +1276,6 @@ wss.on("connection", async (ws: WebSocket, req) => { clearTimeout(timeoutId); } - if (pingInterval) { - clearInterval(pingInterval); - pingInterval = null; - } - if (sshStream) { try { sshStream.end(); @@ -1320,24 +1312,12 @@ wss.on("connection", async (ws: WebSocket, req) => { }, 100); } - function setupPingInterval() { - pingInterval = setInterval(() => { - if (sshConn && sshStream) { - try { - sshStream.write("\x00"); - } catch (e: unknown) { - sshLogger.error( - "SSH keepalive failed: " + - (e instanceof Error ? e.message : "Unknown error"), - ); - cleanupSSH(); - } - } else if (!sshConn || !sshStream) { - if (pingInterval) { - clearInterval(pingInterval); - pingInterval = null; - } - } - }, 30000); - } + // Note: PTY-level keepalive (writing \x00 to the stream) was removed. + // It was causing ^@ characters to appear in terminals with echoctl enabled. + // SSH-level keepalive is configured via connectConfig (keepaliveInterval, + // keepaliveCountMax, tcpKeepAlive), which handles connection health monitoring + // without producing visible output on the terminal. + // + // See: https://github.com/Termix-SSH/Support/issues/232 + // See: https://github.com/Termix-SSH/Support/issues/309 });