mirror of
https://github.com/ChronosX88/KademliaDHT.git
synced 2024-11-22 02:02:21 +00:00
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:
parent
9c05736ef8
commit
1e6b9f2e38
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user