From 63bf084a6a673f1020290f1d18f3dad79cbd7104 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Wed, 10 Apr 2019 10:25:48 -0400 Subject: [PATCH] cancel dht response future --- lbrynet/dht/protocol/protocol.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lbrynet/dht/protocol/protocol.py b/lbrynet/dht/protocol/protocol.py index c0bdf6a2d..39e80870e 100644 --- a/lbrynet/dht/protocol/protocol.py +++ b/lbrynet/dht/protocol/protocol.py @@ -524,6 +524,10 @@ class KademliaProtocol(DatagramProtocol): response = await asyncio.wait_for(response_fut, self.rpc_timeout) self.peer_manager.report_last_replied(peer.address, peer.udp_port) return response + except asyncio.CancelledError: + if not response_fut.done(): + response_fut.cancel() + raise except (asyncio.TimeoutError, RemoteException): self.peer_manager.report_failure(peer.address, peer.udp_port) if self.peer_manager.peer_is_good(peer) is False: