-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Labels
developmentStandard developmentStandard developmentr&d:polykey:core activity 4End to End Networking behind Consumer NAT DevicesEnd to End Networking behind Consumer NAT Devices
Description
Specification
Adding a node to a NodeGraph
's bucket needs to be updated. There are 3 cases when adding a node that need to be handled
- If the node already exists in the bucket the last updated need to be updated.
- If the node is not already in the bucket AND the bucket has room. The node is added into the bucket.
- If the node is not in the bucket AND the bucket is full. We need to ping the oldest node in the bucket, if the old node does not respond we drop it for the new node, otherwise we drop the new node and update the last updated for the old node.
We need to add a force
flag for always add the new node for manually adding nodes.
The core of the functionality needs to be moved into the NodeManager
. since the NodeGraph
is purely data structure the checking of the nodes before adding them should be handled inside the NodeManager.
As implemented, the NodeGraph
just stores the nodes within buckets and tracks the number of nodes in the bucket. The more complex logic is handled by the NodeManager
now.
Additional context
- Testnet Deployment #326 (comment)
- Relates Testnet Deployment #326
- Relates Improve node search over k-buckets (getClosestLocalNode) #212
- Relates Investigate means of authenticating a node ID when adding to
NodeGraph
#322 - Relates Seed node not adding details of connecting node to its
NodeGraph
#344 - Relates Remove "revoked" node ID -> node address mappings in
NodeGraph
#150 - Relates Expunge any added "invalid" nodes from k-buckets #226
- Relates Supporting the "refresh" operation for
NodeGraph
buckets #345
Tasks
- 1. Remove bucket limit checking and core adding logic from
NodeGraph
toNodeManager.addNode
method.NodeGraph
is purely data-structure anything that requires complex checking or networking needs to be outside it. - 2. Handle cases when adding a node.
- Node already exists.
- Node exists, bucket has room.
- Node exist, bucket is full.
- 3. Add
force
parameter to force adding a node if bucket is full. - Update testing.
- fix any tests broken by logic moving to
NodeManager
- add test for the 3 cases when adding nodes.
- add test for
force
parameter
- fix any tests broken by logic moving to
Metadata
Metadata
Assignees
Labels
developmentStandard developmentStandard developmentr&d:polykey:core activity 4End to End Networking behind Consumer NAT DevicesEnd to End Networking behind Consumer NAT Devices