mirror of
https://github.com/duanhf2012/origin.git
synced 2026-05-19 07:37:29 +08:00
优化rpc
This commit is contained in:
@@ -265,26 +265,31 @@ func (server *Server) selfNodeRpcHandlerGo(processor IRpcProcessor, client *Clie
|
|||||||
return pCall
|
return pCall
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var iParam interface{}
|
||||||
|
|
||||||
|
|
||||||
if processor == nil {
|
if processor == nil {
|
||||||
_, processor = GetProcessorType(args)
|
_, processor = GetProcessorType(args)
|
||||||
}
|
}
|
||||||
|
|
||||||
inParamValue := reflect.New(reflect.ValueOf(args).Type().Elem())
|
if args != nil {
|
||||||
//args
|
inParamValue := reflect.New(reflect.ValueOf(args).Type().Elem())
|
||||||
//复制输入参数
|
//args
|
||||||
iParam := inParamValue.Interface()
|
//复制输入参数
|
||||||
bytes,err := processor.Marshal(args)
|
iParam = inParamValue.Interface()
|
||||||
if err == nil {
|
bytes,err := processor.Marshal(args)
|
||||||
err = processor.Unmarshal(bytes,iParam)
|
if err == nil {
|
||||||
}
|
err = processor.Unmarshal(bytes,iParam)
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
pCall.Seq = 0
|
pCall.Seq = 0
|
||||||
pCall.Err = errors.New("RpcHandler " + handlerName + "."+serviceMethod+" deep copy inParam is error:" + err.Error())
|
pCall.Err = errors.New("RpcHandler " + handlerName + "."+serviceMethod+" deep copy inParam is error:" + err.Error())
|
||||||
pCall.done <- pCall
|
pCall.done <- pCall
|
||||||
log.SError(pCall.Err.Error())
|
log.SError(pCall.Err.Error())
|
||||||
|
|
||||||
return pCall
|
return pCall
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
req := MakeRpcRequest(processor, 0, rpcMethodId, serviceMethod, noReply, nil)
|
req := MakeRpcRequest(processor, 0, rpcMethodId, serviceMethod, noReply, nil)
|
||||||
@@ -335,7 +340,7 @@ func (server *Server) selfNodeRpcHandlerGo(processor IRpcProcessor, client *Clie
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = rpcHandler.PushRpcRequest(req)
|
err := rpcHandler.PushRpcRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ReleaseRpcRequest(req)
|
ReleaseRpcRequest(req)
|
||||||
pCall.Err = err
|
pCall.Err = err
|
||||||
|
|||||||
Reference in New Issue
Block a user