Merge branch 'main' of https://cnb.cool/blzing/blazing
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
昔念
2026-02-24 12:53:16 +08:00
11 changed files with 74 additions and 102 deletions

View File

@@ -86,7 +86,7 @@ func (s *Server) OnClose(c gnet.Conn, err error) (action gnet.Action) {
//logging.Infof("conn[%v] disconnected", c.RemoteAddr().String())
v, _ := c.Context().(*player.ClientData)
v.LF.Close()
//v.LF.Close()
if v.Player != nil {
v.Player.Save() //保存玩家数据
@@ -192,10 +192,7 @@ func (s *Server) handleTCP(conn gnet.Conn) (action gnet.Action) {
conn.Context().(*player.ClientData).IsCrossDomain.Do(func() { //跨域检测
handle(conn)
})
// 1. 检查最小可读长度(避免无效 Peek
if conn.InboundBuffered() < 17 {
return gnet.None
}
// handle(c)
// 先读取4字节的包长度
lenBuf, err := conn.Peek(4)
@@ -284,10 +281,10 @@ func (s *Server) onevent(c gnet.Conn, v []byte) {
} else {
header.Data = nil // 避免空切片分配
}
s.workerPool.Submit(func() {
t.LF.Producer().Write(header)
})
t.OnEvent(header)
// s.workerPool.Submit(func() {
// t.LF.Producer().Write(header)
// })
}
}