From 8d07610e4a39b461482738dfcb39f88caa60cd67 Mon Sep 17 00:00:00 2001 From: guanqun Date: Sat, 4 Dec 2021 02:14:13 +0800 Subject: [PATCH] fix(provider::ws): ignore the websocket response when the request has been cancelled. (#641) --- ethers-providers/src/transports/ws.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ethers-providers/src/transports/ws.rs b/ethers-providers/src/transports/ws.rs index 834e7666..64ea06fc 100644 --- a/ethers-providers/src/transports/ws.rs +++ b/ethers-providers/src/transports/ws.rs @@ -313,7 +313,9 @@ where Err(_) => {} Ok(Incoming::Response(resp)) => { if let Some(request) = self.pending.remove(&resp.id) { - request.send(resp.data.into_result()).map_err(to_client_error)?; + if !request.is_canceled() { + request.send(resp.data.into_result()).map_err(to_client_error)?; + } } } Ok(Incoming::Notification(notification)) => {