This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"blazing/cool"
|
||||
"blazing/logic/service/common"
|
||||
"encoding/binary"
|
||||
"encoding/hex"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -152,7 +153,7 @@ func (h *ClientData) OnEvent(data common.TomeeHeader) {
|
||||
}
|
||||
if err != nil {
|
||||
|
||||
cool.Logger.Error(context.Background(), data.UserID, data.CMD, "解包失败,", err, data.Data)
|
||||
cool.Logger.Error(context.Background(), data.UserID, data.CMD, "解包失败,", err, hex.EncodeToString(data.Data))
|
||||
//fmt.Println(data.UserID, data.CMD, "解包失败,", hex.EncodeToString(data.Data))
|
||||
data.Result = uint32(errorcode.ErrorCodes.ErrSystemProcessingError)
|
||||
playerconn.SendPack(data.Pack(nil))
|
||||
|
||||
@@ -106,9 +106,9 @@ func (s *PetService) Pet_LEVEL_all() []model.Pet {
|
||||
}
|
||||
|
||||
// 精灵真正添加后的捕捉时间才是真正的时间
|
||||
func (s *PetService) PetAdd(y *model.PetInfo) {
|
||||
func (s *PetService) PetAdd(y *model.PetInfo) uint32 {
|
||||
if y == nil {
|
||||
return
|
||||
return 0
|
||||
}
|
||||
sql := fmt.Sprintf(`
|
||||
UPDATE %s
|
||||
@@ -136,7 +136,7 @@ RETURNING max_ts;
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return y.CatchTime
|
||||
}
|
||||
|
||||
// func (s *PetService) ModifyBefore(ctx context.Context, method string, param map[string]interface{}) (err error) {
|
||||
|
||||
Reference in New Issue
Block a user