From ae8827b4768911036fae4bc9ae1dd1899e34e7cb Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Tue, 31 May 2022 17:08:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0RPC=20=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/core.go | 7 ++++++- go.mod | 2 +- go.sum | 2 ++ modules/gateway/agent.go | 2 +- services/s_comps/comp_gateroute.go | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/comm/core.go b/comm/core.go index 3e6eb90b2..b1bc85cc8 100644 --- a/comm/core.go +++ b/comm/core.go @@ -16,7 +16,12 @@ const ( ) const ( //Rpc - Rpc_GateRoute core.Rpc_Key = "Rpc_GateRoute" //网关路由 + Rpc_GatewayRoute core.Rpc_Key = "Rpc_GatewayRoute" //网关路由 + Rpc_GatewayAgentBuild core.Rpc_Key = "Rpc_GatewayAgentBuild" //代理绑定 绑定用户Id + Rpc_GatewayAgentUnBuild core.Rpc_Key = "Rpc_GatewayAgentUnBuild" //代理解绑 解绑用户Id + Rpc_GatewayAgentSendMsg core.Rpc_Key = "Rpc_GatewayAgentSendMsg" //代理发送消息 向用户发送消息 + Rpc_GatewayAgentRadioMsg core.Rpc_Key = "Rpc_GatewayAgentRadioMsg" //代理广播消息 向所有在线用户发送消息 + Rpc_GatewayAgentClose core.Rpc_Key = "Rpc_GatewayAgentClose" //代理关闭 关闭用户连接 ) type ISC_GateRouteComp interface { diff --git a/go.mod b/go.mod index 30a4e5698..d743cdd59 100644 --- a/go.mod +++ b/go.mod @@ -114,4 +114,4 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect ) -replace github.com/liwei1dao/lego => F:\work\go\lego +// replace github.com/liwei1dao/lego => F:\work\go\lego diff --git a/go.sum b/go.sum index 4045c5439..c92262e56 100644 --- a/go.sum +++ b/go.sum @@ -516,6 +516,8 @@ github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.9.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/linkedin/goavro/v2 v2.9.8/go.mod h1:UgQUb2N/pmueQYH9bfqFioWxzYCZXSfF8Jw03O5sjqA= github.com/liwei1dao/dm v0.0.0-20211103094420-938edf103cf0/go.mod h1:YH8wwRWv57a88ZbPtflEhwCQDrcm9L9S8wl9y1m8SnQ= +github.com/liwei1dao/lego v0.0.0-20220531033739-03f821663a48 h1:w7VgcKpPNonCD6rz915LLygN88BJCNMudB/TOFdCD/4= +github.com/liwei1dao/lego v0.0.0-20220531033739-03f821663a48/go.mod h1:eEEe2/9fK64Bo1Mj30Hwdt5BZ8IwKbZ6ZMgCTu8DQ+4= github.com/lucas-clemente/quic-go v0.24.0/go.mod h1:paZuzjXCE5mj6sikVLMvqXk8lJV2AsqtJ6bDhjEfxx0= github.com/lucas-clemente/quic-go v0.27.0 h1:v6WY87q9zD4dKASbG8hy/LpzAVNzEQzw8sEIeloJsc4= github.com/lucas-clemente/quic-go v0.27.0/go.mod h1:AzgQoPda7N+3IqMMMkywBKggIFo2KT6pfnlrQ2QieeI= diff --git a/modules/gateway/agent.go b/modules/gateway/agent.go index 00738942c..44d05f232 100644 --- a/modules/gateway/agent.go +++ b/modules/gateway/agent.go @@ -122,7 +122,7 @@ func (this *Agent) Close() { func (this *Agent) messageDistribution(msg *pb.Message) { reply := &pb.UserMessageReply{} log.Debugf("agent:%s uId:%d MessageDistribution msg:%s", this.sessionId, this.uId, msg.Head.ServiceMethod) - if err := this.gateway.Service().RpcCallByType("worker", string(comm.Rpc_GateRoute), context.Background(), &pb.UserMessage{ + if err := this.gateway.Service().RpcCallByType("worker", string(comm.Rpc_GatewayRoute), context.Background(), &pb.UserMessage{ Ip: this.IP(), UserSessionId: this.sessionId, UserId: this.uId, diff --git a/services/s_comps/comp_gateroute.go b/services/s_comps/comp_gateroute.go index 4338d9065..75c5bf3ec 100644 --- a/services/s_comps/comp_gateroute.go +++ b/services/s_comps/comp_gateroute.go @@ -44,7 +44,7 @@ func (this *SComp_GateRouteComp) Init(service core.IService, comp core.IServiceC } func (this *SComp_GateRouteComp) Start() (err error) { - this.service.RegisterFunctionName(string(comm.Rpc_GateRoute), this.ReceiveMsg) //注册网关路由接收接口 + this.service.RegisterFunctionName(string(comm.Rpc_GatewayRoute), this.ReceiveMsg) //注册网关路由接收接口 err = this.ServiceCompBase.Start() return }