1
This commit is contained in:
@@ -74,8 +74,21 @@ func (h *ClientData) Recv(data common.TomeeHeader) {
|
|||||||
tt1 := ptrValue.Elem().Addr().Interface()
|
tt1 := ptrValue.Elem().Addr().Interface()
|
||||||
// fmt.Println(tt1)
|
// fmt.Println(tt1)
|
||||||
err := struc.Unpack(bytes.NewBuffer(data.Data), tt1)
|
err := struc.Unpack(bytes.NewBuffer(data.Data), tt1)
|
||||||
|
playerconn, cok := h.Conn.Context().(*ClientData)
|
||||||
|
if !cok { //如果链接断开,就返回
|
||||||
|
return
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
||||||
|
head := common.NewTomeeHeader(1001, data.UserID)
|
||||||
|
|
||||||
|
head.Result = uint32(errorcode.ErrorCodes.ErrIllegalLanguage)
|
||||||
|
|
||||||
|
// 实际上这里有个问题,会造成重复保存问题
|
||||||
|
|
||||||
|
playerconn.SendPack(head.Pack(nil))
|
||||||
h.Conn.Close()
|
h.Conn.Close()
|
||||||
|
|
||||||
fmt.Println(data.UserID, data.CMD, "解包失败,", hex.EncodeToString(data.Data))
|
fmt.Println(data.UserID, data.CMD, "解包失败,", hex.EncodeToString(data.Data))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -108,15 +121,11 @@ func (h *ClientData) Recv(data common.TomeeHeader) {
|
|||||||
return
|
return
|
||||||
|
|
||||||
}
|
}
|
||||||
t, cok := h.Conn.Context().(*ClientData)
|
|
||||||
if !cok { //如果链接断开,就返回
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if ok && aa != 0 { //这里实现回复错误包
|
if ok && aa != 0 { //这里实现回复错误包
|
||||||
|
|
||||||
glog.Info(context.Background(), data.UserID, data.CMD, aa.Code())
|
glog.Info(context.Background(), data.UserID, data.CMD, aa.Code())
|
||||||
t.SendPack(data.Pack(nil))
|
playerconn.SendPack(data.Pack(nil))
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -125,7 +134,7 @@ func (h *ClientData) Recv(data common.TomeeHeader) {
|
|||||||
t1 := data.Pack(ret[0].Interface())
|
t1 := data.Pack(ret[0].Interface())
|
||||||
//cool.Loger.Debug(context.Background(), "发送数据_回包", data.UserID, data.CMD, ret[0].Interface(), hex.EncodeToString(t1))
|
//cool.Loger.Debug(context.Background(), "发送数据_回包", data.UserID, data.CMD, ret[0].Interface(), hex.EncodeToString(t1))
|
||||||
//data.Version = 49
|
//data.Version = 49
|
||||||
t.SendPack(t1)
|
playerconn.SendPack(t1)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user