From b54b9e40d5488ca36ab1b0ed780d0df6bd055c0f Mon Sep 17 00:00:00 2001 From: duanhf2012 Date: Thu, 20 Jan 2022 14:44:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96GC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rpc/rpchandler.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/rpc/rpchandler.go b/rpc/rpchandler.go index 989851c..cf25af0 100644 --- a/rpc/rpchandler.go +++ b/rpc/rpchandler.go @@ -59,6 +59,8 @@ type RpcHandler struct { mapRawFunctions map[uint32] RawRpcCallBack funcRpcClient FuncRpcClient funcRpcServer FuncRpcServer + + pClientList []*Client } type TriggerRpcEvent func(bConnect bool,clientSeq uint32,nodeId int) @@ -107,7 +109,7 @@ func (handler *RpcHandler) InitRpcHandler(rpcHandler IRpcHandler,getClientFun Fu handler.mapFunctions = map[string]RpcMethodInfo{} handler.funcRpcClient = getClientFun handler.funcRpcServer = getServerFun - + handler.pClientList = make([]*Client,maxClusterNode) handler.RegisterRpc(rpcHandler) } @@ -542,8 +544,7 @@ func (handler *RpcHandler) CastGo(serviceMethod string,args interface{}) error{ func (handler *RpcHandler) RawGoNode(rpcProcessorType RpcProcessorType,nodeId int,rpcMethodId uint32,serviceName string,rawArgs IRawInputArgs) error { processor := GetProcessor(uint8(rpcProcessorType)) - var pClientList [maxClusterNode]*Client - err,count := handler.funcRpcClient(nodeId,serviceName,pClientList[:]) + err,count := handler.funcRpcClient(nodeId,serviceName,handler.pClientList) if count==0||err != nil { //args.DoGc() log.SError("Call serviceMethod is error:",err.Error()) @@ -559,7 +560,7 @@ func (handler *RpcHandler) RawGoNode(rpcProcessorType RpcProcessorType,nodeId in //2.rpcClient调用 //如果调用本结点服务 for i:=0;i