优化原始rpc,采用register方式

This commit is contained in:
boyce
2020-12-21 16:34:06 +08:00
parent ce2a14fa83
commit 4b67c59b1e
10 changed files with 294 additions and 194 deletions

View File

@@ -40,6 +40,7 @@ type IRpcRequestData interface {
GetServiceMethod() string
GetInParam() []byte
IsNoReply() bool
GetRpcMethodId() uint32
}
type IRpcResponseData interface {
@@ -120,10 +121,10 @@ func (call *Call) Done() *Call{
return <-call.done
}
func MakeRpcRequest(rpcProcessor IRpcProcessor,seq uint64,serviceMethod string,noReply bool,inParam []byte) *RpcRequest{
func MakeRpcRequest(rpcProcessor IRpcProcessor,seq uint64,rpcMethodId uint32,serviceMethod string,noReply bool,inParam []byte) *RpcRequest{
rpcRequest := rpcRequestPool.Get().(*RpcRequest).Clear()
rpcRequest.rpcProcessor = rpcProcessor
rpcRequest.RpcRequestData = rpcRequest.rpcProcessor.MakeRpcRequest(seq,serviceMethod,noReply,inParam)
rpcRequest.RpcRequestData = rpcRequest.rpcProcessor.MakeRpcRequest(seq,rpcMethodId,serviceMethod,noReply,inParam)
rpcRequest.ref = true
return rpcRequest