From 69d4b9f422485b514ca6053ae19c00907ffe4cf6 Mon Sep 17 00:00:00 2001 From: Mmx <1624045573@qq.com> Date: Sun, 11 Jul 2021 13:15:23 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=AE=88=E6=8A=A4=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=8E=89=E7=BA=BF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/daemon.go | 2 +- controllers/guardian.go | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/controllers/daemon.go b/controllers/daemon.go index 3b74f73..5485ae0 100644 --- a/controllers/daemon.go +++ b/controllers/daemon.go @@ -8,6 +8,6 @@ func init() { goDaemon := flag.Bool("daemon", false, "") flag.Parse() if *goDaemon { - Guardian() + Guardian(false) } } diff --git a/controllers/guardian.go b/controllers/guardian.go index 6dc0926..e6e17a5 100644 --- a/controllers/guardian.go +++ b/controllers/guardian.go @@ -8,14 +8,16 @@ import ( "time" ) -func Guardian() { +func Guardian(output bool) { for { + global.Status.Output = output time.Sleep(time.Duration(global.Config.Settings.Guardian) * time.Second) go func() { defer func() { _ = recover() }() if !util.Checker.NetOk() { + util.Log.Println("Network down, trying to login") _ = Login(false) } }() @@ -34,6 +36,6 @@ func EnterGuardian() { util.Log.Println("[Daemon mode entered]") return } - Guardian() + Guardian(true) } }