feat: M3 mosh 挂起→恢复<3s(唤醒脉冲 + 会话状态机三相)
- SessionMachine 加 mosh 三相(moshActive/moshParked/moshResuming)+看门狗兜底, mosh 接管即拆 SSH、后台冻结不重建、前台唤醒脉冲等 SSP 续(+5 单测) - bridge.go: Node.WakeUp()(tsnet InjectEvent+MagicSock.Rebind/ReSTUN) + MoshRelay.Rebind()(同端口重开 loopback、泵按 socket 生成容错) - iosclient.cc: g_mosh_last_heard 探针(导出 mosh_last_heard_ms) + SIGCONT 全屏重绘 - MoshSession: nudge()(SIGCONT) + lastHeardMs();SSHTerminalModel 前台脉冲三连 + healthy 轮询 + beginBackgroundTask;URL scheme 供无头前台唤醒 - 验证(vohive-vm over tsnet):15s 冻结→前台 wake pulse→1.3s recovered,<3s Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -14,4 +14,10 @@ extern "C"
|
||||
int mosh_main(FILE *f_in, FILE *f_out, struct winsize *window_size,
|
||||
const char *ip, const char *port, const char *key, const char *predict_mode);
|
||||
|
||||
/* M3:最近一次收到新服务器状态的 mosh 单调时刻(ms);0=从未。前台恢复判定用。 */
|
||||
#if __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
unsigned long long mosh_last_heard_ms(void);
|
||||
|
||||
#endif /* CMOSH_MOSHIOSBRIDGE_H */
|
||||
|
||||
@@ -86,6 +86,16 @@ public final class MoshSession: @unchecked Sendable {
|
||||
}
|
||||
}
|
||||
|
||||
/// M3:唤醒 mosh 主循环(前台恢复)——发 SIGCONT,触发 select 立即 tick、发包、全屏重绘。
|
||||
public func nudge() {
|
||||
lock.lock(); let tid = moshThread; lock.unlock()
|
||||
if let tid { pthread_kill(tid, SIGCONT) }
|
||||
}
|
||||
|
||||
/// M3:mosh 最近收到新(已认证)服务器状态的时刻(mosh 单调钟 ms);0=从未。
|
||||
/// 前台恢复时取基线、轮询其增长即判定 SSP 已续(healthy)。
|
||||
public func lastHeardMs() -> UInt64 { UInt64(mosh_last_heard_ms()) }
|
||||
|
||||
/// 更新终端尺寸并通知 mosh(SIGWINCH → process_resize)。
|
||||
public func resize(cols: Int, rows: Int) {
|
||||
winPtr.pointee.ws_col = UInt16(cols)
|
||||
|
||||
Reference in New Issue
Block a user