From dd02c706b76b6a6ade8a30e81325e6b4434a0443 Mon Sep 17 00:00:00 2001 From: boyce Date: Wed, 4 Nov 2020 15:52:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=8F=E5=B0=91=E5=AD=97=E7=AC=A6=E4=B8=B2?= =?UTF-8?q?=E6=8B=BC=E6=8E=A5-gc=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rpc/rpchandler.go | 23 +++++++++-------------- rpc/server.go | 19 ++++++++++--------- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/rpc/rpchandler.go b/rpc/rpchandler.go index d467a16..cc6cf24 100644 --- a/rpc/rpchandler.go +++ b/rpc/rpchandler.go @@ -371,13 +371,12 @@ func (handler *RpcHandler) goRpc(processor IRpcProcessor,bCast bool,nodeId int,s continue } serviceName := serviceMethod[:findIndex] - method := serviceMethod[findIndex+1:] if serviceName == handler.rpcHandler.GetName() { //自己服务调用 //调用自己rpcHandler处理器 - return pLocalRpcServer.myselfRpcHandlerGo(serviceName,method,args,nil) + return pLocalRpcServer.myselfRpcHandlerGo(serviceName,serviceMethod,args,nil) } //其他的rpcHandler的处理器 - pCall := pLocalRpcServer.selfNodeRpcHandlerGo(processor,pClientList[i],true,serviceName,method,args,nil,nil) + pCall := pLocalRpcServer.selfNodeRpcHandlerGo(processor,pClientList[i],true,serviceName,serviceMethod,args,nil,nil) if pCall.Err!=nil { err = pCall.Err } @@ -421,13 +420,12 @@ func (handler *RpcHandler) callRpc(nodeId int,serviceMethod string,args interfac return err } serviceName := serviceMethod[:findIndex] - method := serviceMethod[findIndex+1:] if serviceName == handler.rpcHandler.GetName() { //自己服务调用 //调用自己rpcHandler处理器 - return pLocalRpcServer.myselfRpcHandlerGo(serviceName,method,args,reply) + return pLocalRpcServer.myselfRpcHandlerGo(serviceName,serviceMethod,args,reply) } //其他的rpcHandler的处理器 - pCall := pLocalRpcServer.selfNodeRpcHandlerGo(nil,pClient,false,serviceName,method,args,reply,nil) + pCall := pLocalRpcServer.selfNodeRpcHandlerGo(nil,pClient,false,serviceName,serviceMethod,args,reply,nil) err = pCall.Done().Err pClient.RemovePending(pCall.Seq) ReleaseCall(pCall) @@ -495,10 +493,9 @@ func (handler *RpcHandler) asyncCallRpc(nodeid int,serviceMethod string,args int return nil } serviceName := serviceMethod[:findIndex] - method := serviceMethod[findIndex+1:] //调用自己rpcHandler处理器 if serviceName == handler.rpcHandler.GetName() { //自己服务调用 - err := pLocalRpcServer.myselfRpcHandlerGo(serviceName,method,args,reply) + err := pLocalRpcServer.myselfRpcHandlerGo(serviceName,serviceMethod,args,reply) if err == nil { fVal.Call([]reflect.Value{reflect.ValueOf(reply),NilError}) }else{ @@ -508,13 +505,13 @@ func (handler *RpcHandler) asyncCallRpc(nodeid int,serviceMethod string,args int //其他的rpcHandler的处理器 if callback!=nil { - err = pLocalRpcServer.selfNodeRpcHandlerAsyncGo(pClient, handler,false,serviceName,method,args,reply,fVal) + err = pLocalRpcServer.selfNodeRpcHandlerAsyncGo(pClient, handler,false,serviceName,serviceMethod,args,reply,fVal) if err != nil { fVal.Call([]reflect.Value{reflect.ValueOf(reply),reflect.ValueOf(err)}) } return nil } - pCall := pLocalRpcServer.selfNodeRpcHandlerGo(nil,pClient,false,serviceName,method,args,reply,nil) + pCall := pLocalRpcServer.selfNodeRpcHandlerGo(nil,pClient,false,serviceName,serviceMethod,args,reply,nil) err = pCall.Done().Err pClient.RemovePending(pCall.Seq) ReleaseCall(pCall) @@ -585,7 +582,6 @@ func (handler *RpcHandler) RawGoNode(rpcProcessorType RpcProcessorType,nodeId in //2.rpcclient调用 //如果调用本结点服务 for i:=0;i