Replacement Cache update

- If we're trying to add a node that's already in the replacement cache, update the last seen time of this node
This commit is contained in:
Joshua Kissoon 2014-05-01 11:44:25 +05:30
parent 9c05736ef8
commit 1e6b9f2e38

View File

@ -173,7 +173,13 @@ public class KadBucket implements Bucket
/* Just return if this contact is already in our replacement cache */ /* Just return if this contact is already in our replacement cache */
if (this.replacementCache.containsKey(c)) if (this.replacementCache.containsKey(c))
{ {
/* @todo update last seen time */ /**
* If the contact is already in the bucket, lets update that we've seen it
* We need to remove and re-add the contact to get the Sorted Set to update sort order
*/
Contact tmp = this.replacementCache.remove(c);
tmp.setSeenNow();
this.replacementCache.put(tmp, tmp);
return; return;
} }