mirror of
https://github.com/duanhf2012/origin.git
synced 2026-03-05 21:57:33 +08:00
优化RPC responder调用
This commit is contained in:
@@ -273,6 +273,20 @@ func (server *Server) selfNodeRpcHandlerGo(processor IRpcProcessor,client *Clien
|
|||||||
if noReply == false {
|
if noReply == false {
|
||||||
client.AddPending(pCall)
|
client.AddPending(pCall)
|
||||||
req.requestHandle = func(Returns interface{},Err RpcError){
|
req.requestHandle = func(Returns interface{},Err RpcError){
|
||||||
|
if reply != nil && Returns != reply && Returns != nil {
|
||||||
|
byteReturns, err := req.rpcProcessor.Marshal(Returns)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("returns data cannot be marshal",pCall.Seq)
|
||||||
|
ReleaseRpcRequest(req)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = req.rpcProcessor.Unmarshal(byteReturns, reply)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("returns data cannot be Unmarshal",pCall.Seq)
|
||||||
|
ReleaseRpcRequest(req)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
v := client.RemovePending(pCall.Seq)
|
v := client.RemovePending(pCall.Seq)
|
||||||
if v == nil {
|
if v == nil {
|
||||||
log.Error("rpcClient cannot find seq %d in pending",pCall.Seq)
|
log.Error("rpcClient cannot find seq %d in pending",pCall.Seq)
|
||||||
|
|||||||
Reference in New Issue
Block a user