feat:守护增加掉线提示

This commit is contained in:
Mmx
2021-07-11 13:15:23 +08:00
parent 5f9ded64a8
commit 69d4b9f422
2 changed files with 5 additions and 3 deletions

View File

@@ -8,6 +8,6 @@ func init() {
goDaemon := flag.Bool("daemon", false, "")
flag.Parse()
if *goDaemon {
Guardian()
Guardian(false)
}
}

View File

@@ -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)
}
}