mirror of https://github.com/bmuller/kademlia.git
Update routing.py
This commit is contained in:
parent
00ecaf5e31
commit
a9e390126c
|
@ -21,11 +21,11 @@ class KBucket(object):
|
|||
return self.nodes.values()
|
||||
|
||||
def split(self):
|
||||
midpoint = self.range[1] - ((self.range[1] - self.range[0]) / 2)
|
||||
midpoint = (self.range[0] + self.range[1]) / 2
|
||||
one = KBucket(self.range[0], midpoint, self.ksize)
|
||||
two = KBucket(midpoint + 1, self.range[1], self.ksize)
|
||||
for node in self.nodes.values():
|
||||
bucket = one if node.long_id <= midpoint else two
|
||||
bucket = one if node.id <= midpoint else two
|
||||
bucket.nodes[node.id] = node
|
||||
return (one, two)
|
||||
|
||||
|
|
Loading…
Reference in New Issue