Skip to content

Commit

Permalink
fix: 去除守护模式重复的网络检查
Browse files Browse the repository at this point in the history
  • Loading branch information
Mmx committed Sep 19, 2021
1 parent 005e795 commit 12e9b00
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion controllers/guardian.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
13 changes: 7 additions & 6 deletions controllers/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 12e9b00

Please sign in to comment.