feat(socket): 添加服务器优雅退出机制 在 Server 结构体中新增 quit 字段,并在 OnTick 方法中检查该字段, 若为 true 则调用 os.Exit(0) 实现程序正常退出。同时清理了 controller 中 冗余的导入和无用逻辑,优化 server 启动流程并修复 RPC 客户端传递错误问题。 ```
20 lines
328 B
Go
20 lines
328 B
Go
package socket
|
|
|
|
import (
|
|
"blazing/logic/service/player"
|
|
"fmt"
|
|
)
|
|
|
|
func (h *Server) KickPerson(a int) error {
|
|
|
|
fmt.Println("检测到踢人请求", a)
|
|
player.KickPlayer(uint32(a))
|
|
return nil
|
|
}
|
|
func (h *Server) QuitSelf(a int) error {
|
|
//TODO 这里待退出
|
|
fmt.Println("检测到退出请求")
|
|
h.quit = true
|
|
return nil
|
|
}
|