fix(zmodem): 接收路径写背压;sftp 删除容忍 ENOENT;sysinfo 停止关流

- zmodem 接收:fs WriteStream 缓冲无上限,慢盘 + 快对端可把内存涨到接近
  文件大小。write() 返回 false 时暂停喂入 sentry 的 ssh 流、drain 恢复;
  touchActivity 只在写入被接受或 drain 恢复时计数,stall 看门狗不再把
  '堆在缓冲里'当进展;finalize/detach 解除悬挂暂停
- sftp 删除路径 ENOENT 一律视为已删成功(文件已被他人删除/重复删除/
  传输重跑后目标已消失),不再汇成假 delete failed;真错误仍报错
  (tests/sftp-timeout.mjs 新增 5 断言含防过度吞错用例)
- sysinfo:exec 回调里 state.stopped 分支先 close 到手的 stream
This commit is contained in:
Bill committed 2026-10-09 11:30:51 +08:00
1 parent 81ac112dac
commit e23010f950
4 files changed
+247 -12

No files matched your search

+11 -1
View File
@@ -157,7 +157,17 @@ function pollOnce(id: string, state: PollState): void {
try {
client.exec(COLLECT_CMD, (err: Error | undefined, stream) => {
if (state.stopped) return
if (state.stopped) {
// Polling stopped while this exec was in flight: the channel is already
// open, so simply dropping the stream would leak it for the rest of the
// ssh session. Close it (best effort — it may be dead already) and go.
try {
stream?.close()
} catch {
// best effort
}
return
}
if (err || !stream) {
handleError(id, state, err?.message || t('main.sysinfo.execFailed'))
return