mirror of
https://github.com/ChronosX88/KademliaDHT.git
synced 2024-11-22 02:02:21 +00:00
Updated content lookup operation and node lookup operation
- Use all nodes to these operations initially instead of the K-Closest because there may be the case that the K-Closest are offline - The operation takes care of looking at the K-Closest.
This commit is contained in:
parent
4e643c7f3f
commit
9c05736ef8
@ -97,6 +97,10 @@ public class ContentLookupOperation implements Operation, Receiver
|
||||
/* Set the local node as already asked */
|
||||
nodes.put(this.localNode.getNode(), ASKED);
|
||||
|
||||
/**
|
||||
* We add all nodes here instead of the K-Closest because there may be the case that the K-Closest are offline
|
||||
* - The operation takes care of looking at the K-Closest.
|
||||
*/
|
||||
this.addNodes(this.localNode.getRoutingTable().getAllNodes());
|
||||
|
||||
/**
|
||||
|
@ -96,7 +96,11 @@ public class NodeLookupOperation implements Operation, Receiver
|
||||
/* Set the local node as already asked */
|
||||
nodes.put(this.localNode.getNode(), ASKED);
|
||||
|
||||
this.addNodes(this.localNode.getRoutingTable().findClosest(this.lookupId, this.config.k()));
|
||||
/**
|
||||
* We add all nodes here instead of the K-Closest because there may be the case that the K-Closest are offline
|
||||
* - The operation takes care of looking at the K-Closest.
|
||||
*/
|
||||
this.addNodes(this.localNode.getRoutingTable().getAllNodes());
|
||||
|
||||
/* If we haven't finished as yet, wait for a maximum of config.operationTimeout() time */
|
||||
int totalTimeWaited = 0;
|
||||
|
@ -173,6 +173,7 @@ public class KadBucket implements Bucket
|
||||
/* Just return if this contact is already in our replacement cache */
|
||||
if (this.replacementCache.containsKey(c))
|
||||
{
|
||||
/* @todo update last seen time */
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user