Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacement buckets #26

Open
wants to merge 70 commits into
base: main
Choose a base branch
from
Open

Replacement buckets #26

wants to merge 70 commits into from

Conversation

Blitz3r123
Copy link
Collaborator

No description provided.

Copy link
Member

@srene srene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@srene
Copy link
Member

srene commented Apr 6, 2023

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.
So you basically have to:
1 - Get the node id from the bucket (BigInteger).
2 - Convert the node id to Node instance.
3- Get the KademliaProtocol instance from Node instance.
4- Operate in the RoutingTable of the KademliaProtocol instance to do whatever is necessary.

@Blitz3r123 Blitz3r123 force-pushed the replacement_buckets branch 2 times, most recently from 9a3b9a9 to 4016a04 Compare May 9, 2023 15:56
srene and others added 30 commits May 9, 2023 16:57
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] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants