forked from LBRYCommunity/lbry-sdk
Merge branch 'dht-fix-close-nodes-list-extension' of https://github.com/ordex/lbry into ordex-dht-fix-close-nodes-list-extension
This commit is contained in:
commit
ee90c877c7
2 changed files with 11 additions and 4 deletions
|
@ -15,6 +15,14 @@ at anytime.
|
|||
### Fixed
|
||||
*
|
||||
*
|
||||
* Fixed slow startup for nodes with many lbry files
|
||||
* Fixed setting the external ip on startup
|
||||
* Fixed session startup not blocking on joining the dht
|
||||
* Fixed several parsing bugs that prevented replacing dead dht contacts
|
||||
* Fixed lbryid length validation
|
||||
* Fixed an old print statement that polluted logs
|
||||
* Fixed rpc id length for dht requests
|
||||
* Fixed amount of closed nodes to add to list in case of extension to neighbouring k-buckets
|
||||
|
||||
### Deprecated
|
||||
*
|
||||
|
|
|
@ -138,15 +138,14 @@ class TreeRoutingTable(object):
|
|||
# Fill up the node list to k nodes, starting with the closest neighbouring nodes known
|
||||
while len(closestNodes) < min(count, constants.k) and (canGoLower or canGoHigher):
|
||||
# TODO: this may need to be optimized
|
||||
remain = min(count, constants.k) - len(closestNodes)
|
||||
if canGoLower:
|
||||
closestNodes.extend(
|
||||
self._buckets[bucketIndex - i].getContacts(
|
||||
constants.k - len(closestNodes), _rpcNodeID))
|
||||
self._buckets[bucketIndex - i].getContacts(remain, _rpcNodeID))
|
||||
canGoLower = bucketIndex - (i + 1) >= 0
|
||||
if canGoHigher:
|
||||
closestNodes.extend(
|
||||
self._buckets[bucketIndex + i].getContacts(constants.k - len(closestNodes),
|
||||
_rpcNodeID))
|
||||
self._buckets[bucketIndex + i].getContacts(remain, _rpcNodeID))
|
||||
canGoHigher = bucketIndex + (i + 1) < len(self._buckets)
|
||||
i += 1
|
||||
return closestNodes
|
||||
|
|
Loading…
Reference in a new issue