Tunnels: Use max of 2 not-failing peers in an exploratory tunnel,

use high cap for the rest; change outbound exploratory
default length from 2 + 0-1 to 3+0.
This commit is contained in:
zzz
2015-09-27 16:01:22 +00:00
parent 22417715e7
commit 39b810bd79
4 changed files with 57 additions and 36 deletions

View File

@ -1,3 +1,15 @@
2015-09-27 zzz
* Console:
- Export SSL cert on creation
- New /certs page to show local SSL certs
- Show 'none' if no leasesets
* SimpleTimer2: Fix bug in forceReschedule() that caused subsequent uncaught IllegalStateException,
affected streaming timers
* Streaming: Move throttler from context timer to streaming timer
* Tunnels: Use max of 2 not-failing peers in an exploratory tunnel,
use high cap for the rest; change outbound exploratory
default length from 2 + 0-1 to 3+0.
2015-09-25 dg 2015-09-25 dg
* Rename _() for translation to _t() for Java 9 compatibility (ticket #1456) * Rename _() for translation to _t() for Java 9 compatibility (ticket #1456)

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Monotone"; public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION; public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 9; public final static long BUILD = 10;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = ""; public final static String EXTRA = "";

View File

@ -76,11 +76,11 @@ public class TunnelPoolSettings {
private static final int DEFAULT_LENGTH_VARIANCE = 0; private static final int DEFAULT_LENGTH_VARIANCE = 0;
/** expl only */ /** expl only */
private static final int DEFAULT_IB_EXPL_LENGTH = 2; private static final int DEFAULT_IB_EXPL_LENGTH = 2;
//private static final int DEFAULT_OB_EXPL_LENGTH = isSlow ? 2 : 3; private static final int DEFAULT_OB_EXPL_LENGTH = isSlow ? 2 : 3;
private static final int DEFAULT_OB_EXPL_LENGTH = 2; //private static final int DEFAULT_OB_EXPL_LENGTH = 2;
private static final int DEFAULT_IB_EXPL_LENGTH_VARIANCE = isSlow ? 0 : 1; private static final int DEFAULT_IB_EXPL_LENGTH_VARIANCE = isSlow ? 0 : 1;
//private static final int DEFAULT_OB_EXPL_LENGTH_VARIANCE = 0; private static final int DEFAULT_OB_EXPL_LENGTH_VARIANCE = 0;
private static final int DEFAULT_OB_EXPL_LENGTH_VARIANCE = isSlow ? 0 : 1; //private static final int DEFAULT_OB_EXPL_LENGTH_VARIANCE = isSlow ? 0 : 1;
public static final boolean DEFAULT_ALLOW_ZERO_HOP = true; public static final boolean DEFAULT_ALLOW_ZERO_HOP = true;
public static final int DEFAULT_IP_RESTRICTION = 2; // class B (/16) public static final int DEFAULT_IP_RESTRICTION = 2; // class B (/16)

View File

@ -33,12 +33,12 @@ class ExploratoryPeerSelector extends TunnelPeerSelector {
return null; return null;
} }
if (false && shouldSelectExplicit(settings)) { //if (false && shouldSelectExplicit(settings)) {
List<Hash> rv = selectExplicit(settings, length); // List<Hash> rv = selectExplicit(settings, length);
if (l.shouldLog(Log.DEBUG)) // if (l.shouldLog(Log.DEBUG))
l.debug("Explicit peers selected: " + rv); // l.debug("Explicit peers selected: " + rv);
return rv; // return rv;
} //}
Set<Hash> exclude = getExclude(settings.isInbound(), true); Set<Hash> exclude = getExclude(settings.isInbound(), true);
exclude.add(ctx.routerHash()); exclude.add(ctx.routerHash());
@ -55,34 +55,43 @@ class ExploratoryPeerSelector extends TunnelPeerSelector {
// FloodfillNetworkDatabaseFacade fac = (FloodfillNetworkDatabaseFacade)ctx.netDb(); // FloodfillNetworkDatabaseFacade fac = (FloodfillNetworkDatabaseFacade)ctx.netDb();
// exclude.addAll(fac.getFloodfillPeers()); // exclude.addAll(fac.getFloodfillPeers());
HashSet<Hash> matches = new HashSet<Hash>(length); HashSet<Hash> matches = new HashSet<Hash>(length);
boolean exploreHighCap = shouldPickHighCap();
// if (length > 0) {
// We don't honor IP Restriction here, to be fixed boolean exploreHighCap = shouldPickHighCap();
//
// If hidden and inbound, use fast peers - that we probably have recently //
// connected to and so they have our real RI - to maximize the chance // We don't honor IP Restriction here, to be fixed
// that the adjacent hop can connect to us. //
if (settings.isInbound() && ctx.router().isHidden()) {
if (l.shouldLog(Log.INFO)) // If hidden and inbound, use fast peers - that we probably have recently
l.info("EPS SFP " + length + (settings.isInbound() ? " IB" : " OB") + " exclude " + exclude.size()); // connected to and so they have our real RI - to maximize the chance
ctx.profileOrganizer().selectFastPeers(length, exclude, matches); // that the adjacent hop can connect to us.
} else if (exploreHighCap) { if (settings.isInbound() && ctx.router().isHidden()) {
if (l.shouldLog(Log.INFO)) if (l.shouldLog(Log.INFO))
l.info("EPS SHCP " + length + (settings.isInbound() ? " IB" : " OB") + " exclude " + exclude.size()); l.info("EPS SFP " + length + (settings.isInbound() ? " IB" : " OB") + " exclude " + exclude.size());
ctx.profileOrganizer().selectHighCapacityPeers(length, exclude, matches); ctx.profileOrganizer().selectFastPeers(length, exclude, matches);
} else if (ctx.commSystem().haveHighOutboundCapacity()) { } else if (exploreHighCap) {
if (l.shouldLog(Log.INFO)) if (l.shouldLog(Log.INFO))
l.info("EPS SNFP " + length + (settings.isInbound() ? " IB" : " OB") + " exclude " + exclude.size()); l.info("EPS SHCP " + length + (settings.isInbound() ? " IB" : " OB") + " exclude " + exclude.size());
ctx.profileOrganizer().selectNotFailingPeers(length, exclude, matches, false); ctx.profileOrganizer().selectHighCapacityPeers(length, exclude, matches);
} else { // use only connected peers so we don't make more connections } else if (ctx.commSystem().haveHighOutboundCapacity()) {
if (l.shouldLog(Log.INFO)) if (l.shouldLog(Log.INFO))
l.info("EPS SANFP " + length + (settings.isInbound() ? " IB" : " OB") + " exclude " + exclude.size()); l.info("EPS SNFP " + length + (settings.isInbound() ? " IB" : " OB") + " exclude " + exclude.size());
ctx.profileOrganizer().selectActiveNotFailingPeers(length, exclude, matches); // As of 0.9.23, we include a max of 2 not failing peers,
// to improve build success on 3-hop tunnels.
// Peer org credits existing items in matches
if (length > 2)
ctx.profileOrganizer().selectHighCapacityPeers(length - 2, exclude, matches);
ctx.profileOrganizer().selectNotFailingPeers(length, exclude, matches, false);
} else { // use only connected peers so we don't make more connections
if (l.shouldLog(Log.INFO))
l.info("EPS SANFP " + length + (settings.isInbound() ? " IB" : " OB") + " exclude " + exclude.size());
ctx.profileOrganizer().selectActiveNotFailingPeers(length, exclude, matches);
}
matches.remove(ctx.routerHash());
} }
matches.remove(ctx.routerHash());
ArrayList<Hash> rv = new ArrayList<Hash>(matches); ArrayList<Hash> rv = new ArrayList<Hash>(matches);
if (rv.size() > 1) if (rv.size() > 1)
orderPeers(rv, settings.getRandomKey()); orderPeers(rv, settings.getRandomKey());