Merge branch 'main' of github.com:72wo/blazing

This commit is contained in:
2025-10-18 10:12:54 +08:00
12 changed files with 82 additions and 64 deletions

View File

@@ -155,14 +155,17 @@ func (s *Server) handleTcp(conn gnet.Conn) (action gnet.Action) {
conn.Context().(*player.ClientData).IsCrossDomain = true
data, err := s.codec.Decode(conn)
if err != nil {
if err != codec.ErrIncompletePacket {
action = gnet.Close
return
} else {
if err == codec.ErrIncompletePacket&&conn.InboundBuffered()>0 {
t, _ := conn.Peek(conn.InboundBuffered())
cool.Loger.Debug(context.Background(), "断包", err.Error(), conn.InboundBuffered(), t)
if err := conn.Wake(nil); err != nil { // wake up the connection manually to avoid missing the leftover data
logging.Errorf("failed to wake up the connection, %v", err)
return gnet.Close
}
} else {
action = gnet.Close
return
}
}