优化变量名称

This commit is contained in:
duanhf2012
2020-04-01 18:15:50 +08:00
parent c714196498
commit 004512234f
2 changed files with 7 additions and 8 deletions

View File

@@ -151,7 +151,7 @@ type RpcResponse struct {
Err *RpcError
//returns
Returns []byte
Reply []byte
}
@@ -179,14 +179,15 @@ func (slf *Client) Run(){
delete(slf.pending,respone.Seq)
slf.pendingLock.Unlock()
v.Err = nil
//*****如果对方返回nil测试跨node时调用其他服务rpc不存在的情况
if len(respone.Returns) >0 {
err = processor.Unmarshal(respone.Returns,v.Reply)
if len(respone.Reply) >0 {
err = processor.Unmarshal(respone.Reply,v.Reply)
if err != nil {
log.Error("rpcClient Unmarshal body error,error:%+v",err)
v.Err = err
}
}
if respone.Err != nil {
v.Err= respone.Err
}
@@ -194,10 +195,8 @@ func (slf *Client) Run(){
if v.callback.IsValid() {
v.rpcHandler.(*RpcHandler).callResponeCallBack<-v
}else{
//发送至接受者
v.done <- v
}
}
}
}

View File

@@ -84,8 +84,8 @@ func (agent *RpcAgent) WriteRespone(serviceMethod string,seq uint64,reply interf
rpcRespone.Err = err
var errM error
if reply!=nil {
rpcRespone.Returns,errM = processor.Marshal(reply)
if errM!= nil {
rpcRespone.Reply,errM = processor.Marshal(reply)
if errM != nil {
rpcRespone.Err = ConvertError(errM)
}
}