From de78bd9b5dbe73fd541e9453cf3e3a73751ca859 Mon Sep 17 00:00:00 2001 From: Eloahman Date: Sat, 6 Aug 2016 22:46:24 +0800 Subject: [PATCH] Async call should be scheduled in loop --- kademlia/routing.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kademlia/routing.py b/kademlia/routing.py index 3f00e92..0f9aa4c 100644 --- a/kademlia/routing.py +++ b/kademlia/routing.py @@ -1,8 +1,9 @@ import heapq import time import operator -from collections import OrderedDict +import asyncio +from collections import OrderedDict from kademlia.utils import OrderedSet, sharedPrefix @@ -158,7 +159,7 @@ class RoutingTable(object): self.splitBucket(index) self.addContact(node) else: - self.protocol.callPing(bucket.head()) + asyncio.ensure_future(self.protocol.callPing(bucket.head())) def getBucketFor(self, node): """