Changeset 0db1314


Ignore:
Timestamp:
Dec 10, 2013 2:31:08 AM (6 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
289a8e7
Parents:
6864162 (diff), 8699c82 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

propagate from branch 'i2p.i2p.zzz.netdbkad' (head bc7310e940f01e68bd6be0ed0681eb624dada332)

to branch 'i2p.i2p' (head 98569f30891693e6888913f50b88d1f37969fe45)

Files:
1 added
7 deleted
12 edited
10 moved

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/jsp/debug.jsp

    r6864162 r0db1314  
    2121     */
    2222    net.i2p.router.RouterContext ctx = (net.i2p.router.RouterContext) net.i2p.I2PAppContext.getGlobalContext();
     23
     24    /*
     25     *  Print out the status for the NetDB
     26     */
     27    out.print("<h2>Router DHT</h2>");
     28    ctx.netDb().renderStatusHTML(out);
    2329
    2430    /*
  • build.xml

    r6864162 r0db1314  
    477477            <group title="BOB Demos" packages="net.i2p.BOB.Demos.echo.echoclient:net.i2p.BOB.Demos.echo.echoserver" />
    478478            <group title="Desktopgui Application" packages="net.i2p.desktopgui:net.i2p.desktopgui.*" />
    479             <group title="I2PSnark Application" packages="org.klomp.snark:org.klomp.snark.*:net.i2p.kademlia" />
     479            <group title="I2PSnark Application" packages="org.klomp.snark:org.klomp.snark.*" />
    480480            <group title="I2PTunnel Application" packages="net.i2p.i2ptunnel:net.i2p.i2ptunnel.*" />
    481481            <group title="Installer Utilities" packages="net.i2p.installer" />
  • core/java/src/net/i2p/kademlia/KBucket.java

    r6864162 r0db1314  
    1818 *
    1919 * Refactored from net.i2p.router.networkdb.kademlia
    20  * @since 0.9.2
     20 * @since 0.9.2 in i2psnark, moved to core in 0.9.10
    2121 */
    2222public interface KBucket<T extends SimpleDataStructure> {
  • core/java/src/net/i2p/kademlia/KBucketImpl.java

    r6864162 r0db1314  
    4242 *
    4343 *  Refactored from net.i2p.router.networkdb.kademlia
    44  *  @since 0.9.2
     44 *  @since 0.9.2 in i2psnark, moved to core in 0.9.10
    4545 */
    4646class KBucketImpl<T extends SimpleDataStructure> implements KBucket<T> {
  • core/java/src/net/i2p/kademlia/KBucketSet.java

    r6864162 r0db1314  
    3636 *
    3737 * Refactored from net.i2p.router.networkdb.kademlia
    38  * @since 0.9.2
     38 * @since 0.9.2 in i2psnark, moved to core in 0.9.10
    3939 */
    4040public class KBucketSet<T extends SimpleDataStructure> {
  • core/java/src/net/i2p/kademlia/KBucketTrimmer.java

    r6864162 r0db1314  
    55/**
    66 *  Called when a kbucket can no longer be split and is too big
    7  *  @since 0.9.2
     7 *  @since 0.9.2 in i2psnark, moved to core in 0.9.10
    88 */
    99public interface KBucketTrimmer<K extends SimpleDataStructure> {
  • core/java/src/net/i2p/kademlia/RandomIfOldTrimmer.java

    r6864162 r0db1314  
    66/**
    77 *  Removes a random element, but only if the bucket hasn't changed in 5 minutes.
    8  *  @since 0.9.2
     8 *  @since 0.9.2 in i2psnark, moved to core in 0.9.10
    99 */
    1010public class RandomIfOldTrimmer<T extends SimpleDataStructure> extends RandomTrimmer<T> {
  • core/java/src/net/i2p/kademlia/RandomTrimmer.java

    r6864162 r0db1314  
    99/**
    1010 *  Removes a random element. Not resistant to flooding.
    11  *  @since 0.9.2
     11 *  @since 0.9.2 in i2psnark, moved to core in 0.9.10
    1212 */
    1313public class RandomTrimmer<T extends SimpleDataStructure> implements KBucketTrimmer<T> {
     
    2727            return true;
    2828        T toRemove = e.get(_ctx.random().nextInt(sz));
    29         return kbucket.remove(toRemove);
     29        kbucket.remove(toRemove);
     30        return true;
    3031    }
    3132}
  • core/java/src/net/i2p/kademlia/RejectTrimmer.java

    r6864162 r0db1314  
    55/**
    66 *  Removes nothing and always rejects the add. Flood resistant..
    7  *  @since 0.9.2
     7 *  @since 0.9.2 in i2psnark, moved to core in 0.9.10
    88 */
    99public class RejectTrimmer<T extends SimpleDataStructure> implements KBucketTrimmer<T> {
  • core/java/src/net/i2p/kademlia/SelectionCollector.java

    r6864162 r0db1314  
    55/**
    66 * Visit kbuckets, gathering matches
    7  * @since 0.9.2
     7 * @since 0.9.2 in i2psnark, moved to core in 0.9.10
    88 */
    99public interface SelectionCollector<T extends SimpleDataStructure> {
  • core/java/src/net/i2p/kademlia/XORComparator.java

    r6864162 r0db1314  
    88 * Help sort Hashes in relation to a base key using the XOR metric
    99 *
    10  * @since 0.9.2
     10 * @since 0.9.2 in i2psnark, moved to core in 0.9.10
    1111 */
    12 class XORComparator<T extends SimpleDataStructure> implements Comparator<T> {
     12public class XORComparator<T extends SimpleDataStructure> implements Comparator<T> {
    1313    private final byte[] _base;
    1414
  • core/java/src/net/i2p/kademlia/package.html

    r6864162 r0db1314  
    22This is a major rewrite of KBucket, KBucketSet, and KBucketImpl from net.i2p.router.networkdb.kademlia.
    33The classes are now generic to support SHA1. SHA256, or other key lengths.
    4 The long-term goal is to prove out this new implementation in i2psnark,
    5 then move it to core, then convert the network database to use it.
     4Packaged in i2psnark since 0.9.2, and moved to core in 0.9.10
     5so the network database can use it.
    66</p></body></html>
  • router/java/src/net/i2p/router/NetworkDatabaseFacade.java

    r6864162 r0db1314  
    7575    public boolean isInitialized() { return true; }
    7676    public void rescan() {}
    77     /** @deprecated moved to router console */
     77
     78    /** Debug only - all user info moved to NetDbRenderer in router console */
    7879    public void renderStatusHTML(Writer out) throws IOException {}
    7980    /** public for NetDbRenderer in routerconsole */
  • router/java/src/net/i2p/router/networkdb/kademlia/ExploreJob.java

    r6864162 r0db1314  
    1616import net.i2p.data.TunnelId;
    1717import net.i2p.data.i2np.DatabaseLookupMessage;
     18import net.i2p.kademlia.KBucketSet;
    1819import net.i2p.router.RouterContext;
    1920import net.i2p.util.Log;
     
    9899        }
    99100
    100         KBucketSet ks = _facade.getKBuckets();
     101        KBucketSet<Hash> ks = _facade.getKBuckets();
    101102        Hash rkey = getContext().routingKeyGenerator().getRoutingKey(getState().getTarget());
    102103        // in a few releases, we can (and should) remove this,
  • router/java/src/net/i2p/router/networkdb/kademlia/ExploreKeySelectorJob.java

    r6864162 r0db1314  
    99 */
    1010
     11import java.util.Collection;
    1112import java.util.HashSet;
    1213import java.util.Set;
    1314
    1415import net.i2p.data.Hash;
     16import net.i2p.kademlia.KBucket;
     17import net.i2p.kademlia.KBucketSet;
    1518import net.i2p.router.JobImpl;
    1619import net.i2p.router.RouterContext;
     
    2932   
    3033    private final static long RERUN_DELAY_MS = 60*1000;
     34    private final static long OLD_BUCKET_TIME = 15*60*1000;
    3135   
    3236    public ExploreKeySelectorJob(RouterContext context, KademliaNetworkDatabaseFacade facade) {
     
    4246            return;
    4347        }
    44         Set<Hash> toExplore = selectKeysToExplore();
     48        Collection<Hash> toExplore = selectKeysToExplore();
    4549        _log.info("Filling the explorer pool with: " + toExplore);
    4650        if (toExplore != null)
     
    5458     *
    5559     */
    56     private Set<Hash> selectKeysToExplore() {
     60    private Collection<Hash> selectKeysToExplore() {
    5761        Set<Hash> alreadyQueued = _facade.getExploreKeys();
    58         if (alreadyQueued.size() > KBucketSet.NUM_BUCKETS) return null;
    59         Set<Hash> toExplore = new HashSet<Hash>(KBucketSet.NUM_BUCKETS - alreadyQueued.size());
    60         for (int i = 0; i < KBucketSet.NUM_BUCKETS; i++) {
    61             KBucket bucket = _facade.getKBuckets().getBucket(i);
    62             if (bucket.getKeyCount() < KBucketSet.BUCKET_SIZE) {
    63                 boolean already = false;
    64                 for (Hash key : alreadyQueued) {
    65                     if (bucket.shouldContain(key)) {
    66                         already = true;
    67                         _log.debug("Bucket " + i + " is already queued for exploration \t" + key);
    68                         break;
    69                     }
    70                 }
    71                 if (!already) {
    72                     // no keys are queued for exploring this still-too-small bucket yet
    73                     Hash key = bucket.generateRandomKey();
    74                     _log.debug("Bucket " + i + " is NOT queued for exploration, and it only has " + bucket.getKeyCount() + " keys, so explore with \t" + key);
    75                     toExplore.add(key);
    76                 }
    77             } else {
    78                 _log.debug("Bucket " + i + " already has enough keys (" + bucket.getKeyCount() + "), no need to explore further");
    79             }
    80         }
    81         return toExplore;
     62        if (alreadyQueued.size() > KademliaNetworkDatabaseFacade.MAX_EXPLORE_QUEUE)
     63            return null;
     64        return _facade.getKBuckets().getExploreKeys(OLD_BUCKET_TIME);
    8265    }
    8366   
  • router/java/src/net/i2p/router/networkdb/kademlia/FloodOnlySearchJob.java

    r6864162 r0db1314  
    88import net.i2p.data.Hash;
    99import net.i2p.data.i2np.DatabaseLookupMessage;
     10import net.i2p.kademlia.KBucketSet;
    1011import net.i2p.router.Job;
    1112import net.i2p.router.MessageSelector;
     
    7071        // new
    7172        List<Hash> floodfillPeers;
    72         KBucketSet ks = _facade.getKBuckets();
     73        KBucketSet<Hash> ks = _facade.getKBuckets();
    7374        if (ks != null) {
    7475            Hash rkey = getContext().routingKeyGenerator().getRoutingKey(_key);
  • router/java/src/net/i2p/router/networkdb/kademlia/FloodfillPeerSelector.java

    r6864162 r0db1314  
    2121import net.i2p.data.RouterAddress;
    2222import net.i2p.data.RouterInfo;
     23import net.i2p.kademlia.KBucketSet;
     24import net.i2p.kademlia.SelectionCollector;
     25import net.i2p.kademlia.XORComparator;
    2326import net.i2p.router.RouterContext;
    2427import net.i2p.router.peermanager.PeerProfile;
     
    5457     */
    5558    @Override
    56     List<Hash> selectMostReliablePeers(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet kbuckets) {
     59    List<Hash> selectMostReliablePeers(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet<Hash> kbuckets) {
    5760        return selectNearestExplicitThin(key, maxNumRouters, peersToIgnore, kbuckets, true);
    5861    }
     
    6972     */
    7073    @Override
    71     List<Hash> selectNearestExplicitThin(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet kbuckets) {
     74    List<Hash> selectNearestExplicitThin(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet<Hash> kbuckets) {
    7275        return selectNearestExplicitThin(key, maxNumRouters, peersToIgnore, kbuckets, false);
    7376    }
     
    8285     * @return List of Hash for the peers selected
    8386     */
    84     List<Hash> selectNearestExplicitThin(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet kbuckets, boolean preferConnected) {
     87    List<Hash> selectNearestExplicitThin(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet<Hash> kbuckets, boolean preferConnected) {
    8588        if (peersToIgnore == null)
    8689            peersToIgnore = Collections.singleton(_context.routerHash());
     
    105108     *  List is not sorted and not shuffled.
    106109     */
    107     List<Hash> selectFloodfillParticipants(KBucketSet kbuckets) {
     110    List<Hash> selectFloodfillParticipants(KBucketSet<Hash> kbuckets) {
    108111        Set<Hash> ignore = Collections.singleton(_context.routerHash());
    109112        return selectFloodfillParticipants(ignore, kbuckets);
     
    117120     *  List is not sorted and not shuffled.
    118121     */
    119     private List<Hash> selectFloodfillParticipants(Set<Hash> toIgnore, KBucketSet kbuckets) {
     122    private List<Hash> selectFloodfillParticipants(Set<Hash> toIgnore, KBucketSet<Hash> kbuckets) {
    120123      /*****
    121124        if (kbuckets == null) return Collections.EMPTY_LIST;
     
    156159     *  Group 3: All others
    157160     */
    158     List<Hash> selectFloodfillParticipants(Hash key, int maxNumRouters, KBucketSet kbuckets) {
     161    List<Hash> selectFloodfillParticipants(Hash key, int maxNumRouters, KBucketSet<Hash> kbuckets) {
    159162        Set<Hash> ignore = Collections.singleton(_context.routerHash());
    160163        return selectFloodfillParticipants(key, maxNumRouters, ignore, kbuckets);
     
    176179     *  @param kbuckets now unused
    177180     */
    178     List<Hash> selectFloodfillParticipants(Hash key, int howMany, Set<Hash> toIgnore, KBucketSet kbuckets) {
     181    List<Hash> selectFloodfillParticipants(Hash key, int howMany, Set<Hash> toIgnore, KBucketSet<Hash> kbuckets) {
    179182        if (toIgnore == null) {
    180183            toIgnore = Collections.singleton(_context.routerHash());
     
    194197     *  @param kbuckets now unused
    195198     */
    196     private List<Hash> selectFloodfillParticipantsIncludingUs(Hash key, int howMany, Set<Hash> toIgnore, KBucketSet kbuckets) {
     199    private List<Hash> selectFloodfillParticipantsIncludingUs(Hash key, int howMany, Set<Hash> toIgnore, KBucketSet<Hash> kbuckets) {
    197200        List<Hash> ffs = selectFloodfillParticipants(toIgnore, kbuckets);
    198         TreeSet<Hash> sorted = new TreeSet<Hash>(new XORComparator(key));
     201        TreeSet<Hash> sorted = new TreeSet<Hash>(new XORComparator<Hash>(key));
    199202        sorted.addAll(ffs);
    200203
     
    340343    }
    341344
    342     private class FloodfillSelectionCollector implements SelectionCollector {
     345    private class FloodfillSelectionCollector implements SelectionCollector<Hash> {
    343346        private final TreeSet<Hash> _sorted;
    344347        private final List<Hash>  _floodfillMatches;
     
    355358        public FloodfillSelectionCollector(Hash key, Set<Hash> toIgnore, int wanted) {
    356359            _key = key;
    357             _sorted = new TreeSet<Hash>(new XORComparator(key));
     360            _sorted = new TreeSet<Hash>(new XORComparator<Hash>(key));
    358361            _floodfillMatches = new ArrayList<Hash>(8);
    359362            _toIgnore = toIgnore;
     
    476479     */
    477480    @Override
    478     List<Hash> selectNearest(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet kbuckets) {
     481    List<Hash> selectNearest(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet<Hash> kbuckets) {
    479482        Hash rkey = _context.routingKeyGenerator().getRoutingKey(key);
    480483        if (peersToIgnore != null && peersToIgnore.contains(Hash.FAKE_HASH)) {
  • router/java/src/net/i2p/router/networkdb/kademlia/IterativeSearchJob.java

    r6864162 r0db1314  
    1717import net.i2p.data.i2np.DatabaseLookupMessage;
    1818import net.i2p.data.i2np.I2NPMessage;
     19import net.i2p.kademlia.KBucketSet;
     20import net.i2p.kademlia.XORComparator;
    1921import net.i2p.router.CommSystemFacade;
    2022import net.i2p.router.Job;
     
    9496        _expiration = _timeoutMs + ctx.clock().now();
    9597        _rkey = ctx.routingKeyGenerator().getRoutingKey(key);
    96         _toTry = new TreeSet<Hash>(new XORComparator(_rkey));
     98        _toTry = new TreeSet<Hash>(new XORComparator<Hash>(_rkey));
    9799        _unheardFrom = new HashSet<Hash>(CONCURRENT_SEARCHES);
    98100        _failedPeers = new HashSet<Hash>(TOTAL_SEARCH_LIMIT);
     
    110112        // pick some floodfill peers and send out the searches
    111113        List<Hash> floodfillPeers;
    112         KBucketSet ks = _facade.getKBuckets();
     114        KBucketSet<Hash> ks = _facade.getKBuckets();
    113115        if (ks != null) {
    114116            // Ideally we would add the key to an exclude list, so we don't try to query a ff peer for itself,
  • router/java/src/net/i2p/router/networkdb/kademlia/KademliaNetworkDatabaseFacade.java

    r6864162 r0db1314  
    1010
    1111import java.io.IOException;
     12import java.io.Writer;
     13import java.util.Collection;
    1214import java.util.Collections;
    1315import java.util.Date;
     
    2628import net.i2p.data.i2np.DatabaseLookupMessage;
    2729import net.i2p.data.i2np.DatabaseStoreMessage;
     30import net.i2p.kademlia.KBucketSet;
     31import net.i2p.kademlia.RejectTrimmer;
     32import net.i2p.kademlia.SelectionCollector;
    2833import net.i2p.router.Job;
    2934import net.i2p.router.NetworkDatabaseFacade;
     
    4247public class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacade {
    4348    protected final Log _log;
    44     private KBucketSet _kb; // peer hashes sorted into kbuckets, but within kbuckets, unsorted
     49    private KBucketSet<Hash> _kb; // peer hashes sorted into kbuckets, but within kbuckets, unsorted
    4550    private DataStore _ds; // hash to DataStructure mapping, persisted when necessary
    4651    /** where the data store is pushing the data */
     
    133138    protected final static long PUBLISH_JOB_DELAY = 5*60*1000l;
    134139
    135     private static final int MAX_EXPLORE_QUEUE = 128;
     140    static final int MAX_EXPLORE_QUEUE = 128;
     141
     142    /**
     143     *  kad K
     144     *  Was 500 in old implementation but that was with B ~= -8!
     145     */
     146    private static final int BUCKET_SIZE = 16;
     147    private static final int KAD_B = 3;
    136148
    137149    public KademliaNetworkDatabaseFacade(RouterContext context) {
     
    169181    }
    170182
    171     KBucketSet getKBuckets() { return _kb; }
     183    KBucketSet<Hash> getKBuckets() { return _kb; }
    172184    DataStore getDataStore() { return _ds; }
    173185   
     
    186198    }
    187199   
    188     public void removeFromExploreKeys(Set<Hash> toRemove) {
     200    public void removeFromExploreKeys(Collection<Hash> toRemove) {
    189201        if (!_initialized) return;
    190202        _exploreKeys.removeAll(toRemove);
     
    192204    }
    193205
    194     public void queueForExploration(Set<Hash> keys) {
     206    public void queueForExploration(Collection<Hash> keys) {
    195207        if (!_initialized) return;
    196208        for (Iterator<Hash> iter = keys.iterator(); iter.hasNext() && _exploreKeys.size() < MAX_EXPLORE_QUEUE; ) {
     
    241253        RouterInfo ri = _context.router().getRouterInfo();
    242254        String dbDir = _context.getProperty(PROP_DB_DIR, DEFAULT_DB_DIR);
    243         _kb = new KBucketSet(_context, ri.getIdentity().getHash());
     255        _kb = new KBucketSet<Hash>(_context, ri.getIdentity().getHash(),
     256                                   BUCKET_SIZE, KAD_B, new RejectTrimmer<Hash>());
    244257        try {
    245258            _ds = new PersistentDataStore(_context, dbDir, this);
     
    369382    }
    370383   
    371     private class CountRouters implements SelectionCollector {
     384    private class CountRouters implements SelectionCollector<Hash> {
    372385        private int _count;
    373386        public int size() { return _count; }
     
    10461059        _context.jobQueue().addJob(new StoreJob(_context, this, key, ds, onSuccess, onFailure, sendTimeout, toIgnore));
    10471060    }
     1061
     1062    /**
     1063     * Debug info, HTML formatted
     1064     * @since 0.9.10
     1065     */
     1066    @Override
     1067    public void renderStatusHTML(Writer out) throws IOException {
     1068        out.write(_kb.toString().replace("\n", "<br>\n"));
     1069    }
    10481070}
  • router/java/src/net/i2p/router/networkdb/kademlia/PeerSelector.java

    r6864162 r0db1314  
    1818import net.i2p.data.Hash;
    1919import net.i2p.data.RouterInfo;
     20import net.i2p.kademlia.KBucketSet;
     21import net.i2p.kademlia.SelectionCollector;
    2022import net.i2p.router.RouterContext;
    2123import net.i2p.router.util.HashDistance;
     
    4244     * @return ordered list of Hash objects
    4345     */
    44     List<Hash> selectMostReliablePeers(Hash key, int numClosest, Set<Hash> alreadyChecked, KBucketSet kbuckets) {
     46    List<Hash> selectMostReliablePeers(Hash key, int numClosest, Set<Hash> alreadyChecked, KBucketSet<Hash> kbuckets) {
    4547        // get the peers closest to the key
    4648        return selectNearestExplicit(key, numClosest, alreadyChecked, kbuckets);
     
    5557     * @return List of Hash for the peers selected, ordered by bucket (but intra bucket order is not defined)
    5658     */
    57     List<Hash> selectNearestExplicit(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet kbuckets) {
     59    List<Hash> selectNearestExplicit(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet<Hash> kbuckets) {
    5860        //if (true)
    5961            return selectNearestExplicitThin(key, maxNumRouters, peersToIgnore, kbuckets);
     
    9597     * @return List of Hash for the peers selected, ordered by bucket (but intra bucket order is not defined)
    9698     */
    97     List<Hash> selectNearestExplicitThin(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet kbuckets) {
     99    List<Hash> selectNearestExplicitThin(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet<Hash> kbuckets) {
    98100        if (peersToIgnore == null)
    99101            peersToIgnore = new HashSet<Hash>(1);
     
    110112   
    111113    /** UNUSED */
    112     private class MatchSelectionCollector implements SelectionCollector {
     114    private class MatchSelectionCollector implements SelectionCollector<Hash> {
    113115        private TreeMap<BigInteger, Hash> _sorted;
    114116        private Hash _key;
     
    201203     * @return List of Hash for the peers selected, ordered by bucket (but intra bucket order is not defined)
    202204     */
    203     List<Hash> selectNearest(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet kbuckets) {
     205    List<Hash> selectNearest(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet<Hash> kbuckets) {
    204206        // sure, this may not be exactly correct per kademlia (peers on the border of a kbucket in strict kademlia
    205207        // would behave differently) but I can see no reason to keep around an /additional/ more complicated algorithm.
  • router/java/src/net/i2p/router/networkdb/kademlia/SearchState.java

    r6864162 r0db1314  
    1111
    1212import net.i2p.data.Hash;
     13import net.i2p.kademlia.XORComparator;
    1314import net.i2p.router.RouterContext;
    1415
     
    6263        if (_attemptedPeers.size() <= max)
    6364            return new HashSet<Hash>(_attemptedPeers);
    64         TreeSet<Hash> closest = new TreeSet<Hash>(new XORComparator(target));
     65        TreeSet<Hash> closest = new TreeSet<Hash>(new XORComparator<Hash>(target));
    6566        closest.addAll(_attemptedPeers);
    6667        Set<Hash> rv = new HashSet<Hash>(max);
  • router/java/src/net/i2p/router/networkdb/kademlia/StoreJob.java

    r6864162 r0db1314  
    1919import net.i2p.data.i2np.DatabaseStoreMessage;
    2020import net.i2p.data.i2np.I2NPMessage;
     21import net.i2p.kademlia.KBucketSet;
    2122import net.i2p.router.Job;
    2223import net.i2p.router.JobImpl;
     
    232233    private List<Hash> getClosestFloodfillRouters(Hash key, int numClosest, Set<Hash> alreadyChecked) {
    233234        Hash rkey = getContext().routingKeyGenerator().getRoutingKey(key);
    234         KBucketSet ks = _facade.getKBuckets();
     235        KBucketSet<Hash> ks = _facade.getKBuckets();
    235236        if (ks == null) return new ArrayList<Hash>();
    236237        return ((FloodfillPeerSelector)_peerSelector).selectFloodfillParticipants(rkey, numClosest, alreadyChecked, ks);
Note: See TracChangeset for help on using the changeset viewer.