Changeset 042cde2


Ignore:
Timestamp:
Oct 2, 2010 5:04:52 PM (10 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
3d9b606
Parents:
3b2aa94
Message:
  • UDP:
    • Try to avoid running out of introducers by relaxing selection criteria and increasing minimum number of potential introducers
Location:
router/java/src/net/i2p/router/transport/udp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/transport/udp/IntroductionManager.java

    r3b2aa94 r042cde2  
    9797        start = start % sz;
    9898        int found = 0;
    99         long inactivityCutoff = _context.clock().now() - (UDPTransport.EXPIRE_TIMEOUT / 2);
     99        long inactivityCutoff = _context.clock().now() - (UDPTransport.EXPIRE_TIMEOUT / 2);    // 15 min
     100        // if not too many to choose from, be less picky
     101        if (sz <= howMany + 2)
     102            inactivityCutoff -= UDPTransport.EXPIRE_TIMEOUT / 4;
    100103        for (int i = 0; i < sz && found < howMany; i++) {
    101104            PeerState cur = peers.get((start + i) % sz);
     
    120123            }
    121124            // Try to pick active peers...
    122             if (cur.getLastReceiveTime() < inactivityCutoff || cur.getLastSendTime() < inactivityCutoff) {
     125            // FIXME this is really strict and causes us to run out of introducers
     126            // We have much less introducers than we used to have because routers don't offer
     127            // if they are approaching max connections (see EstablishmentManager)
     128            // FIXED, was ||, is this OK now?
     129            if (cur.getLastReceiveTime() < inactivityCutoff && cur.getLastSendTime() < inactivityCutoff) {
    123130                if (_log.shouldLog(Log.INFO))
    124131                    _log.info("Peer is idle too long: " + cur);
     
    136143        }
    137144
     145        // FIXME failsafe if found == 0, relax inactivityCutoff and try again?
     146
    138147        // Try to keep the connection up for two hours after we made anybody an introducer
    139148        long pingCutoff = _context.clock().now() - (2 * 60 * 60 * 1000);
     
    157166     * Just a quick check to see how many volunteers we know,
    158167     * which the Transport uses to see if we need more.
    159      * @return number of peers that have volunteerd to introduce us
     168     * @return number of peers that have volunteered to introduce us
    160169     */
    161170    int introducerCount() {
  • router/java/src/net/i2p/router/transport/udp/UDPTransport.java

    r3b2aa94 r042cde2  
    10181018    private static final int MIN_PEERS = 3;
    10191019    /** minimum peers volunteering to be introducers if we need that */
    1020     private static final int MIN_INTRODUCER_POOL = 4;
     1020    private static final int MIN_INTRODUCER_POOL = 5;
    10211021
    10221022    public TransportBid bid(RouterInfo toAddress, long dataSize) {
Note: See TracChangeset for help on using the changeset viewer.