fix: 去除守护模式重复的网络检查

This commit is contained in:
Mmx
2021-09-19 23:35:05 +08:00
parent 005e7953ad
commit 12e9b00324
3 changed files with 9 additions and 8 deletions

View File

@@ -27,7 +27,7 @@ func Guardian(output bool) {
}()
if !util.Checker.NetOk() {
util.Log.Println("Network down, trying to login")
_ = Login(output)
_ = Login(output, true)
} else {
if global.Config.Settings.DemoMode {
util.Log.Println("Network ok")

View File

@@ -9,14 +9,15 @@ import (
"time"
)
func Login(output bool) error {
func Login(output bool, skipCheck bool) error {
global.Status.Output = output
util.Log.Println("Step0: 检查状态…")
G := global.Config.Generate()
if util.Checker.NetOk() {
util.Log.Println("网络 ok")
return nil
if !skipCheck {
util.Log.Println("Step0: 检查状态…")
if util.Checker.NetOk() {
util.Log.Println("网络 ok")
return nil
}
}
util.Log.Println("Step1: 正在获取客户端ip")

View File

@@ -11,7 +11,7 @@ func main() {
if global.Config.Settings.Guardian != 0 {
controllers.EnterGuardian()
} else if err := controllers.Login(true); err != nil {
} else if err := controllers.Login(true, false); err != nil {
util.Log.Println("运行出错,状态异常")
if global.Config.Settings.DemoMode {
util.Log.Fatalln(err)