Replacement buckets#26
Conversation
…ement() to check for bucket size
srene
left a comment
There was a problem hiding this comment.
i think the checkAndReplaceLast() of the Kbucket should do the following:
- get the last node of the bucket
- check if is alive
- if it is alive move the node to the front of the bucket (do the same in the routing table of the remote node checked in the bucket for the local node)
- if it is dead remove the node from the bucket and pull a random node from the replacement list.
I dont think the function is currently doing this, since it is creating a random id and getting the node from it (probably will fail because the node does not exist), not getting a node from the bucket.
Moreover, i think the obtention of the Node instance from the id should be reconsidered, creating a new empty protocol instance will not work. The issue is that it is necessary to have a protocol id to get the kademliaprotocol instance.
In the previous version we did a hack to get the kademliaprotocol from any Node intsance, however its probably not the best solution because it may be nodes that do not have the protocol.
…t, updated its constructor and KBucket declarations in RoutingTable
|
I think this still will not work because you are creating a KademliaProtocol instance out of nowhere, you need to get it from an existing node. For that youll probably need to move the nodeIdtoNode function out of the Kademliaprotocol because you need it to get the Node instance from the nodeId. |
9a3b9a9 to
4016a04
Compare
Bumps [json](https://github.com/douglascrockford/JSON-java) from 20200518 to 20230227. - [Release notes](https://github.com/douglascrockford/JSON-java/releases) - [Changelog](https://github.com/stleary/JSON-java/blob/master/docs/RELEASES.md) - [Commits](https://github.com/douglascrockford/JSON-java/commits) --- updated-dependencies: - dependency-name: org.json:json dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
No description provided.