全新的进程控制动作状态机

This commit is contained in:
2026-08-07 23:14:13 +08:00
parent ec60a7994a
commit 21d1a4d180
5 changed files with 379 additions and 131 deletions
+3 -3
View File
@@ -64,7 +64,7 @@ func main() {
log.Printf("⚠️ 启动 frpc 失败: %v", err)
} else {
if status, err := pm.Status(); err == nil {
log.Printf("✅ frpc 状态: %s", status.State)
log.Printf("✅ frpc 状态: %s", status.Phase)
if status.PID > 0 {
log.Printf(" PID: %d, 端口: %d", status.PID, status.Port)
}
@@ -94,8 +94,8 @@ func startWatchdog(pm *process.ProcessManager) {
continue
}
if status.State != "running" {
log.Printf("⚠️ frpc 进程已停止 (状态: %s),自动重启...", status.State)
if status.Phase != "RUNNING" {
log.Printf("⚠️ frpc 进程已停止 (状态: %s),自动重启...", status.Phase)
ctx := context.Background()
if err := pm.Start(ctx); err != nil {
log.Printf("❌ 自动重启 frpc 失败: %v", err)