Changeset 9f0f1f5


Ignore:
Timestamp:
Nov 7, 2015 2:46:33 AM (5 years ago)
Author:
zab2 <zab2@…>
Branches:
master
Children:
c901010d
Parents:
7175b1c
Message:

Make more ISJ parameters configurable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/networkdb/kademlia/IterativeSearchJob.java

    r7175b1c r9f0f1f5  
    7272    /** Max number of peers to query */
    7373    private final int _totalSearchLimit;
    74 
     74   
    7575    private static final int MAX_NON_FF = 3;
    7676    /** Max number of peers to query */
     
    8585     *  on to another peer quickly.
    8686     */
     87    private final long _singleSearchTime;
     88    /**
     89     * The default single search time
     90     */
    8791    private static final long SINGLE_SEARCH_TIME = 3*1000;
    8892    /** the actual expire time for a search message */
     
    9296     *  For now, we don't do concurrent, but we keep SINGLE_SEARCH_TIME very short,
    9397     *  so we have effective concurrency in that we fail a search quickly.
     98     */
     99    private final int _maxConcurrent;
     100    /**
     101     * The default _maxConcurrent
    94102     */
    95103    private static final int MAX_CONCURRENT = 1;
     
    129137                            TOTAL_SEARCH_LIMIT_WHEN_FF : TOTAL_SEARCH_LIMIT;
    130138        _totalSearchLimit = ctx.getProperty("netdb.searchLimit", totalSearchLimit);
     139        _singleSearchTime = ctx.getProperty("netdb.singleSearchTime", SINGLE_SEARCH_TIME);
     140        _maxConcurrent = ctx.getProperty("netdb.maxConcurrent", MAX_CONCURRENT);
    131141        _unheardFrom = new HashSet<Hash>(CONCURRENT_SEARCHES);
    132142        _failedPeers = new HashSet<Hash>(_totalSearchLimit);
     
    237247                if (_dead) return;
    238248                pend = _unheardFrom.size();
    239                 if (pend >= MAX_CONCURRENT)
     249                if (pend >= _maxConcurrent)
    240250                    return;
    241251                done = _failedPeers.size();
     
    413423            // Note that the timeout is much shorter than the message expiration (see above)
    414424            Job j = new IterativeTimeoutJob(getContext(), peer, this);
    415             long expire = Math.min(_expiration, now + SINGLE_SEARCH_TIME);
     425            long expire = Math.min(_expiration, now + _singleSearchTime);
    416426            j.getTiming().setStartAfter(expire);
    417427            getContext().jobQueue().addJob(j);
Note: See TracChangeset for help on using the changeset viewer.