From 080ed21627ae2c69dd60a55895244ecce9aacf70 Mon Sep 17 00:00:00 2001 From: Eloahman Date: Tue, 2 Aug 2016 21:55:49 +0800 Subject: [PATCH] Periodic refresh issue fixed for Python3 --- kademlia/network.py | 2 +- kademlia/protocol.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kademlia/network.py b/kademlia/network.py index 7859f96..8dcaf68 100644 --- a/kademlia/network.py +++ b/kademlia/network.py @@ -73,7 +73,7 @@ class Server(object): for id in self.protocol.getRefreshIDs(): node = Node(id) nearest = self.protocol.router.findNeighbors(node, self.alpha) - spider = NodeSpiderCrawl(self.protocol, node, nearest) + spider = NodeSpiderCrawl(self.protocol, node, nearest, self.ksize, self.alpha) ds.append(spider.find()) # do our crawling diff --git a/kademlia/protocol.py b/kademlia/protocol.py index 504d3a5..038246c 100644 --- a/kademlia/protocol.py +++ b/kademlia/protocol.py @@ -22,7 +22,7 @@ class KademliaProtocol(RPCProtocol): """ ids = [] for bucket in self.router.getLonelyBuckets(): - ids.append(random.randint(*bucket.range)) + ids.append(random.randint(*bucket.range).to_bytes(20, byteorder='big')) return ids def rpc_stun(self, sender):