修改心跳逻辑

This commit is contained in:
liwei1dao 2023-02-22 18:45:22 +08:00
parent f1b11de7f2
commit 25d8e8bb72

View File

@ -78,10 +78,7 @@ locp:
break locp break locp
} else { } else {
// this.gateway.Debugf("----------1 agent:%s uId:%s MainType:%s SubType:%s ", this.sessionId, this.uId, msg.MainType, msg.SubType) // this.gateway.Debugf("----------1 agent:%s uId:%s MainType:%s SubType:%s ", this.sessionId, this.uId, msg.MainType, msg.SubType)
var code pb.ErrorCode if msg.MainType == string(comm.ModuleGate) { //心跳消息 无需校验秘钥
code, err = this.secAuth(msg)
if err == nil {
if msg.MainType == string(comm.ModuleGate) { //心跳消息
data, _ := anypb.New(&pb.GatewayHeartbeatResp{ data, _ := anypb.New(&pb.GatewayHeartbeatResp{
Timestamp: configure.Now().Unix(), Timestamp: configure.Now().Unix(),
}) })
@ -93,6 +90,9 @@ locp:
this.wsConn.SetReadDeadline(time.Now().Add(time.Second * 30)) this.wsConn.SetReadDeadline(time.Now().Add(time.Second * 30))
continue continue
} }
var code pb.ErrorCode
code, err = this.secAuth(msg)
if err == nil {
// this.gateway.Debugf("----------2 agent:%s uId:%s MainType:%s SubType:%s ", this.sessionId, this.uId, msg.MainType, msg.SubType) // this.gateway.Debugf("----------2 agent:%s uId:%s MainType:%s SubType:%s ", this.sessionId, this.uId, msg.MainType, msg.SubType)
if err := this.messageDistribution(msg); err != nil { if err := this.messageDistribution(msg); err != nil {
this.gateway.Errorf("messageDistribution err:%v", err) this.gateway.Errorf("messageDistribution err:%v", err)