feat:守护增加掉线提示
This commit is contained in:
@@ -8,6 +8,6 @@ func init() {
|
|||||||
goDaemon := flag.Bool("daemon", false, "")
|
goDaemon := flag.Bool("daemon", false, "")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
if *goDaemon {
|
if *goDaemon {
|
||||||
Guardian()
|
Guardian(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,14 +8,16 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Guardian() {
|
func Guardian(output bool) {
|
||||||
for {
|
for {
|
||||||
|
global.Status.Output = output
|
||||||
time.Sleep(time.Duration(global.Config.Settings.Guardian) * time.Second)
|
time.Sleep(time.Duration(global.Config.Settings.Guardian) * time.Second)
|
||||||
go func() {
|
go func() {
|
||||||
defer func() {
|
defer func() {
|
||||||
_ = recover()
|
_ = recover()
|
||||||
}()
|
}()
|
||||||
if !util.Checker.NetOk() {
|
if !util.Checker.NetOk() {
|
||||||
|
util.Log.Println("Network down, trying to login")
|
||||||
_ = Login(false)
|
_ = Login(false)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@@ -34,6 +36,6 @@ func EnterGuardian() {
|
|||||||
util.Log.Println("[Daemon mode entered]")
|
util.Log.Println("[Daemon mode entered]")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Guardian()
|
Guardian(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user