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