fix client race (#1647)
This commit is contained in:
parent
f0c0f3d4c4
commit
9216a47724
@ -114,8 +114,7 @@ func (r *rpcClient) call(ctx context.Context, node *registry.Node, req Request,
|
|||||||
return errors.InternalServerError("go.micro.client", "connection error: %v", err)
|
return errors.InternalServerError("go.micro.client", "connection error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
seq := atomic.LoadUint64(&r.seq)
|
seq := atomic.AddUint64(&r.seq, 1) - 1
|
||||||
atomic.AddUint64(&r.seq, 1)
|
|
||||||
codec := newRpcCodec(msg, c, cf, "")
|
codec := newRpcCodec(msg, c, cf, "")
|
||||||
|
|
||||||
rsp := &rpcResponse{
|
rsp := &rpcResponse{
|
||||||
@ -232,8 +231,7 @@ func (r *rpcClient) stream(ctx context.Context, node *registry.Node, req Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
// increment the sequence number
|
// increment the sequence number
|
||||||
seq := atomic.LoadUint64(&r.seq)
|
seq := atomic.AddUint64(&r.seq, 1) - 1
|
||||||
atomic.AddUint64(&r.seq, 1)
|
|
||||||
id := fmt.Sprintf("%v", seq)
|
id := fmt.Sprintf("%v", seq)
|
||||||
|
|
||||||
// create codec with stream id
|
// create codec with stream id
|
||||||
|
Loading…
Reference in New Issue
Block a user