* ExploratoryPeerSelector:
- Exclude floodfill peers - Tweak the HighCap vs. NonFailing decision * i2psnark: Increase retries for .torrent fetch * IRC Proxy: Prevent mIRC from sending an alternate DCC request containing an IP * readme.html: Reorder some items * Stats: Add some more required stats * Streaming lib: Fix slow start to be exponential growth, fix congestion avoidance to be linear growth. Should speed up local connections a lot, and remote connections a little.
This commit is contained in:
@ -17,7 +17,7 @@ import net.i2p.CoreVersion;
|
||||
public class RouterVersion {
|
||||
public final static String ID = "$Revision: 1.548 $ $Date: 2008-02-10 15:00:00 $";
|
||||
public final static String VERSION = "0.6.1.32";
|
||||
public final static long BUILD = 7;
|
||||
public final static long BUILD = 8;
|
||||
public static void main(String args[]) {
|
||||
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
||||
System.out.println("Router ID: " + RouterVersion.ID);
|
||||
|
@ -277,6 +277,9 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
|
||||
_lease = (Lease)orderedLeases.get(orderedLeases.firstKey());
|
||||
} else {
|
||||
// strangely, _lease isn't used anywhere except for log messages - ?!?!??!?!?!
|
||||
// Apparently the outbound endpoint gets to pick the inbound gateway
|
||||
// and this whole function is pointless.
|
||||
_lease = (Lease)leases.get(0);
|
||||
}
|
||||
return true;
|
||||
|
@ -5,8 +5,8 @@ import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.TunnelPoolSettings;
|
||||
|
||||
/**
|
||||
* Pick peers randomly out of the fast pool, and put them into tunnels in a
|
||||
* random order
|
||||
* Pick peers randomly out of the fast pool, and put them into tunnels
|
||||
* ordered by XOR distance from a random key.
|
||||
*
|
||||
*/
|
||||
class ClientPeerSelector extends TunnelPeerSelector {
|
||||
|
@ -3,13 +3,14 @@ package net.i2p.router.tunnel.pool;
|
||||
import java.util.*;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.TunnelPoolSettings;
|
||||
import net.i2p.router.networkdb.kademlia.FloodfillNetworkDatabaseFacade;
|
||||
import net.i2p.stat.Rate;
|
||||
import net.i2p.stat.RateStat;
|
||||
import net.i2p.util.Log;
|
||||
|
||||
/**
|
||||
* Pick peers randomly out of the not-failing pool, and put them into randomly
|
||||
* ordered tunnels.
|
||||
* Pick peers randomly out of the not-failing pool, and put them into a tunnel
|
||||
* ordered by XOR distance from a random key.
|
||||
*
|
||||
*/
|
||||
class ExploratoryPeerSelector extends TunnelPeerSelector {
|
||||
@ -31,6 +32,9 @@ class ExploratoryPeerSelector extends TunnelPeerSelector {
|
||||
|
||||
Set exclude = getExclude(ctx, settings.isInbound(), settings.isExploratory());
|
||||
exclude.add(ctx.routerHash());
|
||||
// Don't use ff peers for exploratory tunnels to lessen exposure to netDb searches and stores
|
||||
FloodfillNetworkDatabaseFacade fac = (FloodfillNetworkDatabaseFacade)ctx.netDb();
|
||||
exclude.addAll(fac.getFloodfillPeers());
|
||||
HashSet matches = new HashSet(length);
|
||||
boolean exploreHighCap = shouldPickHighCap(ctx);
|
||||
if (exploreHighCap)
|
||||
@ -52,6 +56,7 @@ class ExploratoryPeerSelector extends TunnelPeerSelector {
|
||||
return rv;
|
||||
}
|
||||
|
||||
private static final int MIN_NONFAILING_PCT = 25;
|
||||
private boolean shouldPickHighCap(RouterContext ctx) {
|
||||
if (Boolean.valueOf(ctx.getProperty("router.exploreHighCapacity", "false")).booleanValue())
|
||||
return true;
|
||||
@ -62,10 +67,27 @@ class ExploratoryPeerSelector extends TunnelPeerSelector {
|
||||
// randomly from the 'not failing' pool. However, if we are having a
|
||||
// hard time building exploratory tunnels, lets fall back again on the
|
||||
// high capacity peers, at least for a little bit.
|
||||
int failPct = getExploratoryFailPercentage(ctx);
|
||||
int failPct;
|
||||
// getEvents() will be 0 for first 10 minutes
|
||||
if (ctx.router().getUptime() <= 11*60*1000) {
|
||||
failPct = 100 - MIN_NONFAILING_PCT;
|
||||
} else {
|
||||
failPct = getExploratoryFailPercentage(ctx);
|
||||
// always try a little, this helps keep the failPct stat accurate too
|
||||
if (failPct > 100 - MIN_NONFAILING_PCT)
|
||||
failPct = 100 - MIN_NONFAILING_PCT;
|
||||
}
|
||||
Log l = ctx.logManager().getLog(getClass());
|
||||
if (l.shouldLog(Log.DEBUG))
|
||||
l.error("Fail pct: " + failPct);
|
||||
return (failPct >= ctx.random().nextInt(100));
|
||||
}
|
||||
|
||||
// We should really use the difference between the exploratory fail rate
|
||||
// and the client fail rate.
|
||||
// (return 100 * ((Efail - Cfail) / (1 - Cfail)))
|
||||
// Even this isn't the "true" rate for the NonFailingPeers pool, since we
|
||||
// are often building exploratory tunnels using the HighCapacity pool.
|
||||
private int getExploratoryFailPercentage(RouterContext ctx) {
|
||||
int timeout = getEvents(ctx, "tunnel.buildExploratoryExpire", 10*60*1000);
|
||||
int reject = getEvents(ctx, "tunnel.buildExploratoryReject", 10*60*1000);
|
||||
@ -76,6 +98,7 @@ class ExploratoryPeerSelector extends TunnelPeerSelector {
|
||||
return (int)(100 * pct);
|
||||
}
|
||||
|
||||
// Use current + last to get more recent and smoother data
|
||||
private int getEvents(RouterContext ctx, String stat, long period) {
|
||||
RateStat rs = ctx.statManager().getRate(stat);
|
||||
if (rs == null)
|
||||
@ -83,6 +106,6 @@ class ExploratoryPeerSelector extends TunnelPeerSelector {
|
||||
Rate r = rs.getRate(period);
|
||||
if (r == null)
|
||||
return 0;
|
||||
return (int)r.getLastEventCount();
|
||||
return (int) (r.getLastEventCount() + r.getCurrentEventCount());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user