Changeset 435683c


Ignore:
Timestamp:
Jul 4, 2011 5:43:45 PM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
b7ff4fe8
Parents:
1f3f17c
Message:
  • Tunnels: Use exploratory tunnels to help maintain a minimum number

of connected peers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/tunnel/pool/ExploratoryPeerSelector.java

    r1f3f17c r435683c  
    6969   
    7070    private static final int MIN_NONFAILING_PCT = 25;
     71    private static final int MIN_ACTIVE_PEERS_STARTUP = 6;
     72    private static final int MIN_ACTIVE_PEERS = 12;
     73
     74    /**
     75     *  Should we pick from the high cap pool instead of the larger not failing pool?
     76     *  This should return false most of the time, but if the not-failing pool's
     77     *  build success rate is much worse, return true so that reliability
     78     *  is maintained.
     79     */
    7180    private static boolean shouldPickHighCap(RouterContext ctx) {
    72         if (Boolean.valueOf(ctx.getProperty("router.exploreHighCapacity", "false")).booleanValue())
     81        if (ctx.getBooleanProperty("router.exploreHighCapacity"))
    7382            return true;
    74         // no need to explore too wildly at first
     83
     84        // If we don't have enough connected peers, use exploratory
     85        // tunnel building to get us better-connected.
     86        // This is a tradeoff, we could easily lose our exploratory tunnels,
     87        // but with so few connected peers, anonymity suffers and reliability
     88        // will decline also, as we repeatedly try to build tunnels
     89        // through the same few peers.
     90        int active = ctx.commSystem().countActivePeers();
     91        if (active < MIN_ACTIVE_PEERS_STARTUP)
     92            return false;
     93
     94        // no need to explore too wildly at first (if we have enough connected peers)
    7595        if (ctx.router().getUptime() <= 5*60*1000)
    7696            return true;
     
    7898        if (ctx.router().gracefulShutdownInProgress())
    7999            return true;
     100
     101        // see above
     102        if (active < MIN_ACTIVE_PEERS)
     103            return false;
     104
    80105        // ok, if we aren't explicitly asking for it, we should try to pick peers
    81106        // randomly from the 'not failing' pool.  However, if we are having a
Note: See TracChangeset for help on using the changeset viewer.