From 71a4be02dd820dde580b95531484c2d5f0841ecc Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Mon, 13 May 2019 15:56:21 -0300 Subject: [PATCH] use loop to create task --- lbrynet/dht/protocol/protocol.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lbrynet/dht/protocol/protocol.py b/lbrynet/dht/protocol/protocol.py index 9559f984c..eff0211c2 100644 --- a/lbrynet/dht/protocol/protocol.py +++ b/lbrynet/dht/protocol/protocol.py @@ -280,7 +280,7 @@ class KademliaProtocol(DatagramProtocol): return RemoteKademliaRPC(self.loop, self.peer_manager, self, peer) def start(self): - self.maintaing_routing_task = asyncio.create_task(self.routing_table_task()) + self.maintaing_routing_task = self.loop.create_task(self.routing_table_task()) def stop(self): if self.maintaing_routing_task: @@ -395,7 +395,7 @@ class KademliaProtocol(DatagramProtocol): while self._to_add: async with self._split_lock: await self._add_peer(self._to_add.pop()) - await asyncio.gather(self._wakeup_routing_task.wait(), asyncio.sleep(.1)) + await asyncio.gather(self._wakeup_routing_task.wait(), asyncio.sleep(.1, loop=self.loop), loop=self.loop) self._wakeup_routing_task.clear() def _handle_rpc(self, sender_contact: 'KademliaPeer', message: RequestDatagram):