diff --git a/modules/gateway/agent.go b/modules/gateway/agent.go index 3b9b6100e..6ebd23dd7 100644 --- a/modules/gateway/agent.go +++ b/modules/gateway/agent.go @@ -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,9 +178,14 @@ func (this *Agent) decodeUserData(msg *pb.UserMessage) (code pb.ErrorCode, err e } msg.Data = ad } else { - if msg.MainType != string(comm.ModuleNotify) && this.UserId() == "" { - this.gateway.Errorf("[%v.%v] Agent UId empty", msg.MainType, msg.SubType) - return pb.ErrorCode_AgentUidEmpty, fmt.Errorf("no login") + 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