bug: prevent interleaving websocket ID load/store operations (#217)
This commit is contained in:
parent
e7fa806f78
commit
79e806f6e9
|
@ -112,8 +112,7 @@ impl JsonRpcClient for Ws {
|
||||||
method: &str,
|
method: &str,
|
||||||
params: T,
|
params: T,
|
||||||
) -> Result<R, ClientError> {
|
) -> Result<R, ClientError> {
|
||||||
let next_id = self.id.load(Ordering::SeqCst) + 1;
|
let next_id = self.id.fetch_add(1, Ordering::SeqCst);
|
||||||
self.id.store(next_id, Ordering::SeqCst);
|
|
||||||
|
|
||||||
// send the message
|
// send the message
|
||||||
let (sender, receiver) = oneshot::channel();
|
let (sender, receiver) = oneshot::channel();
|
||||||
|
|
Loading…
Reference in New Issue