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
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
* 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
|
### Deprecated
|
||||||
*
|
*
|
||||||
|
|
|
@ -138,15 +138,14 @@ class TreeRoutingTable(object):
|
||||||
# Fill up the node list to k nodes, starting with the closest neighbouring nodes known
|
# 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):
|
while len(closestNodes) < min(count, constants.k) and (canGoLower or canGoHigher):
|
||||||
# TODO: this may need to be optimized
|
# TODO: this may need to be optimized
|
||||||
|
remain = min(count, constants.k) - len(closestNodes)
|
||||||
if canGoLower:
|
if canGoLower:
|
||||||
closestNodes.extend(
|
closestNodes.extend(
|
||||||
self._buckets[bucketIndex - i].getContacts(
|
self._buckets[bucketIndex - i].getContacts(remain, _rpcNodeID))
|
||||||
constants.k - len(closestNodes), _rpcNodeID))
|
|
||||||
canGoLower = bucketIndex - (i + 1) >= 0
|
canGoLower = bucketIndex - (i + 1) >= 0
|
||||||
if canGoHigher:
|
if canGoHigher:
|
||||||
closestNodes.extend(
|
closestNodes.extend(
|
||||||
self._buckets[bucketIndex + i].getContacts(constants.k - len(closestNodes),
|
self._buckets[bucketIndex + i].getContacts(remain, _rpcNodeID))
|
||||||
_rpcNodeID))
|
|
||||||
canGoHigher = bucketIndex + (i + 1) < len(self._buckets)
|
canGoHigher = bucketIndex + (i + 1) < len(self._buckets)
|
||||||
i += 1
|
i += 1
|
||||||
return closestNodes
|
return closestNodes
|
||||||
|
|
Loading…
Reference in a new issue