From ab1445510af3dfc394b7ac9f9120cf44ac909b33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=94=E5=BF=B5?= <12574910+72wo@users.noreply.github.com> Date: Tue, 10 Feb 2026 13:05:45 +0800 Subject: [PATCH] 1 --- common/socket/ServerEvent.go | 9 ++++----- common/socket/ServerOption.go | 2 +- common/socket/kick.go | 5 +++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/common/socket/ServerEvent.go b/common/socket/ServerEvent.go index f4868e011..ce7261123 100644 --- a/common/socket/ServerEvent.go +++ b/common/socket/ServerEvent.go @@ -7,7 +7,6 @@ import ( "fmt" "io" "log" - "os" "sync/atomic" "time" @@ -88,10 +87,10 @@ func (s *Server) OnClose(c gnet.Conn, err error) (action gnet.Action) { } func (s *Server) OnTick() (delay time.Duration, action gnet.Action) { g.Log().Async().Info(context.Background(), gtime.Now().ISO8601(), "服务器ID", cool.Config.ServerInfo.OnlineID, "链接数", atomic.LoadInt64(&s.connected)) - if s.quit && atomic.LoadInt64(&s.connected) == 0 { - //执行正常退出逻辑 - os.Exit(0) - } + // if s.quit && atomic.LoadInt64(&s.connected) == 0 { + // //执行正常退出逻辑 + // os.Exit(0) + // } return 30 * time.Second, gnet.None } func (s *Server) OnBoot(eng gnet.Engine) gnet.Action { diff --git a/common/socket/ServerOption.go b/common/socket/ServerOption.go index 8e157f9f6..b036005d5 100644 --- a/common/socket/ServerOption.go +++ b/common/socket/ServerOption.go @@ -23,7 +23,7 @@ type Server struct { codec codec.SocketCodec handler Handler discorse bool - quit bool + //quit bool // batchRead int serverid uint16 port uint16 diff --git a/common/socket/kick.go b/common/socket/kick.go index e73c6b3e6..3a6240f3f 100644 --- a/common/socket/kick.go +++ b/common/socket/kick.go @@ -3,6 +3,7 @@ package socket import ( "blazing/logic/service/player" "fmt" + "os" "time" ) @@ -39,7 +40,7 @@ func (s *Server) QuitSelf(a int) error { //TODO 这里待退出 fmt.Println("检测到退出请求") - s.quit = true + //s.quit = true if a != 0 { player.Mainplayer.Range(func(key uint32, value *player.Player) bool { if value != nil { @@ -62,7 +63,7 @@ func (s *Server) QuitSelf(a int) error { if value != nil { value.Kick(true) } - + os.Exit(0) return false }) }()