fix findCloseNodes when buckets aren't fully populated
This commit is contained in:
parent
ab956d4a8e
commit
de1dc507ac
1 changed files with 5 additions and 1 deletions
|
@ -123,7 +123,11 @@ class TreeRoutingTable(object):
|
|||
@rtype: list
|
||||
"""
|
||||
bucketIndex = self._kbucketIndex(key)
|
||||
closestNodes = self._buckets[bucketIndex].getContacts(constants.k, _rpcNodeID)
|
||||
|
||||
if bucketIndex < len(self._buckets):
|
||||
closestNodes = self._buckets[bucketIndex].getContacts(count, _rpcNodeID)
|
||||
else:
|
||||
closestNodes = []
|
||||
# This method must return k contacts (even if we have the node
|
||||
# with the specified key as node ID), unless there is less
|
||||
# than k remote nodes in the routing table
|
||||
|
|
Loading…
Reference in a new issue