上传wocket 清理代码

This commit is contained in:
liwei1dao 2023-01-29 18:11:50 +08:00
parent b0d5a9b892
commit 5b74551605

View File

@ -70,6 +70,7 @@ locp:
go this.Close()
break locp
}
this.wsConn.SetReadDeadline(time.Now().Add(time.Second * 30))
if err = proto.Unmarshal(data, msg); err != nil {
this.gateway.Errorf("agent:%s uId:%s Unmarshal err:%v", this.sessionId, this.uId, err)
go this.Close()
@ -177,11 +178,16 @@ func (this *Agent) decodeUserData(msg *pb.UserMessage) (code pb.ErrorCode, err e
}
msg.Data = ad
} else {
if msg.MainType != string(comm.ModuleNotify) && this.UserId() == "" {
switch msg.MainType {
case string(comm.ModuleNotify), string(comm.ModuleGate):
return pb.ErrorCode_Success, nil
default:
if this.UserId() == "" {
this.gateway.Errorf("[%v.%v] Agent UId empty", msg.MainType, msg.SubType)
return pb.ErrorCode_AgentUidEmpty, fmt.Errorf("no login")
}
}
}
return pb.ErrorCode_Success, nil
}