fix(agent): agent↔目标段补 5s TCP keepalive——目标假死(进程在但不响应/不发FIN)是全链路最后一段无存活检测的缺口, 观看端会无限挂死画面; 附目标端→观看端断开同步 e2e(回显即关目标, 观看端 0.01s 同步断开)

This commit is contained in:
w11
2026-09-25 01:33:31 +08:00
parent 7a0ec8ded9
commit 560a641809
2 changed files with 68 additions and 0 deletions
+7
View File
@@ -3,6 +3,7 @@ package agent
import (
"io"
"net"
"time"
)
// handleData 处理节点主动打开的数据流:
@@ -35,6 +36,12 @@ func (a *Agent) handleData(stream net.Conn) {
return
}
defer conn.Close()
// agent↔目标段 TCP 保活: 目标假死(进程在但不响应/不发 FIN)时是
// 全链路唯一没有存活检测的段, 不开 keepalive 观看端会无限挂死画面
if tc, ok := conn.(*net.TCPConn); ok {
tc.SetKeepAlive(true)
tc.SetKeepAlivePeriod(5 * time.Second)
}
rf := NewFrame(FrameVersion, CmdTarget, f.StreamID())
_ = rf.Marshal(Ret{Code: 0, Msg: "ok"})