/** * Use the default trim strategy, which removes a random entry. * @param us the local identity (typically a SHA1Hash or Hash) * The class must have a zero-argument constructor. * @param max the Kademlia value "k", the max per bucket, k >= 4 * @param b the Kademlia value "b", split buckets an extra 2**(b-1) times, * b > 0, use 1 for bittorrent, Kademlia paper recommends 5 */ public KBucketSet(I2PAppContext context, T us, int max, int b) { this(context, us, max, b, new RandomTrimmer<T>(context, max)); }
public boolean trim(KBucket<T> kbucket, T toAdd) { if (kbucket.getLastChanged() > _ctx.clock().now() - 5*60*1000) return false; return super.trim(kbucket, toAdd); } }