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:
Joshua Kissoon 2014-05-01 11:41:12 +05:30
parent 4e643c7f3f
commit 9c05736ef8
3 changed files with 31 additions and 22 deletions

View File

@ -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());
/**

View File

@ -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;

View File

@ -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;
}