Skip to content

v0.8.6:SSH 连接失败崩溃修复 / SSH Connection Failure Crash Fix

Choose a tag to compare

@btsd321 btsd321 released this 20 Oct 10:09
· 33 commits to master since this release

中文

修复

  • 🔴 修复 SSH 连接失败导致桌面端崩溃:连接网络不可达的主机(如 ProxyJump 配错)时,底层 socket 的 error 事件在 connectClient reject 之后仍可能异步触发;若无监听器则未捕获异常直接掀翻进程。在 connect() 和 buildJumpChain() 中提前注册防御性 error 监听器,捕获并记录这些异步错误。
  • 修复连接失败后会话状态不正确:首次连接失败时状态机通过 transition(state, { type: 'fail' }) 进入 reconnect-exhausted 终态,会话记录保留让前端能看到错误日志与状态,不再被误标为"已连接"。
  • 修复前端活跃会话判定:isActiveSession 将 reconnect-exhausted 视为终态,连接失败的主机不再在连接表单中显示"已连接"标记。
  • 修复 connectError 字段回归:补回 catch 块中 record.connectError 赋值,恢复前端红色错误消息显示与 use-session-polling 失败检测回调。
  • 简化 connectClient 内部结构:删除与外层调用方重复注册的空函数 defenseHandler 及其 try/finally 包裹,恢复线性代码结构。

English

Fixes

  • 🔴 Fix desktop crash on SSH connection failure: When connecting to an unreachable host (e.g. misconfigured ProxyJump), the underlying socket error event may fire asynchronously after connectClient rejects; without a listener, the uncaught exception crashes the process. Defensive error listeners are now registered early in connect() and buildJumpChain() to catch and log these async errors.
  • Fix incorrect session state after connection failure: On first connection failure, the state machine transitions to reconnect-exhausted terminal state via transition(state, { type: 'fail' }). The session record is retained so the frontend can display error logs and status, instead of being incorrectly marked as "connected".
  • Fix frontend active session detection: isActiveSession now treats reconnect-exhausted as a terminal state; a host whose connection failed no longer shows an "connected" badge in the connect form.
  • Fix connectError field regression: Restored record.connectError assignment in the catch block, recovering the frontend red error message display and the use-session-polling failure detection callback.
  • Simplify connectClient internal structure: Removed the redundant empty defenseHandler function (duplicated with the caller's listener) and its try/finally wrapper, restoring the linear code structure.

Full Changelog: v0.8.5...v0.8.6