From 25d8e8bb720c79a861b90be7ef94f064de572027 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Wed, 22 Feb 2023 18:45:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BF=83=E8=B7=B3=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/gateway/agent.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/gateway/agent.go b/modules/gateway/agent.go index a191abdad..a223ac530 100644 --- a/modules/gateway/agent.go +++ b/modules/gateway/agent.go @@ -78,21 +78,21 @@ locp: break locp } else { // this.gateway.Debugf("----------1 agent:%s uId:%s MainType:%s SubType:%s ", this.sessionId, this.uId, msg.MainType, msg.SubType) + if msg.MainType == string(comm.ModuleGate) { //心跳消息 无需校验秘钥 + data, _ := anypb.New(&pb.GatewayHeartbeatResp{ + Timestamp: configure.Now().Unix(), + }) + this.WriteMsg(&pb.UserMessage{ + MainType: string(comm.ModuleGate), + SubType: "heartbeat", + Data: data, + }) + this.wsConn.SetReadDeadline(time.Now().Add(time.Second * 30)) + continue + } var code pb.ErrorCode code, err = this.secAuth(msg) if err == nil { - if msg.MainType == string(comm.ModuleGate) { //心跳消息 - data, _ := anypb.New(&pb.GatewayHeartbeatResp{ - Timestamp: configure.Now().Unix(), - }) - this.WriteMsg(&pb.UserMessage{ - MainType: string(comm.ModuleGate), - SubType: "heartbeat", - Data: data, - }) - this.wsConn.SetReadDeadline(time.Now().Add(time.Second * 30)) - continue - } // 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 { this.gateway.Errorf("messageDistribution err:%v", err)