优化rpc返回协议

Signed-off-by: boyce <boyce@atbc.com>
This commit is contained in:
boyce
2020-07-10 16:17:56 +08:00
parent 7e72782c16
commit 93b9c4f89a
9 changed files with 46 additions and 42 deletions

View File

@@ -140,7 +140,7 @@ func (agent *RpcAgent) Run() {
continue
}
if req.RpcRequestData.IsReply()== false {
if req.RpcRequestData.IsNoReply()==false {
req.requestHandle = func(Returns interface{},Err *RpcError){
agent.WriteRespone(req.RpcRequestData.GetServiceMethod(),req.RpcRequestData.GetSeq(),Returns,Err)
}
@@ -149,7 +149,11 @@ func (agent *RpcAgent) Run() {
err = rpcHandler.PushRequest(req)
if err != nil {
rpcError := RpcError(err.Error())
agent.WriteRespone(req.RpcRequestData.GetServiceMethod(),req.RpcRequestData.GetSeq(),nil,&rpcError)
if req.RpcRequestData.IsNoReply() {
agent.WriteRespone(req.RpcRequestData.GetServiceMethod(),req.RpcRequestData.GetSeq(),nil,&rpcError)
}
processor.ReleaseRpcRequest(req.RpcRequestData)
ReleaseRpcRequest(req)
}