* Tunnels:

- Build a new exploratory fallback tunnel in the BuildExecutor
     loop if we run out.
   - Don't use closest expl. tunnel as the paired tunnel for a build,
     use a random one instead (partially back out change from -12)
   - Log tweaks
This commit is contained in:
zzz
2013-10-29 21:01:53 +00:00
parent 91ef3fd0bc
commit 0506a5915b
2 changed files with 15 additions and 6 deletions

View File

@@ -129,7 +129,7 @@ class BuildExecutor implements Runnable {
} }
} }
if (allowed < 2) allowed = 2; // Never choke below 2 builds (but congestion may) if (allowed < 2) allowed = 2; // Never choke below 2 builds (but congestion may)
if (allowed > MAX_CONCURRENT_BUILDS) allowed = MAX_CONCURRENT_BUILDS; // Never go beyond 10, that is uncharted territory (old limit was 5) else if (allowed > MAX_CONCURRENT_BUILDS) allowed = MAX_CONCURRENT_BUILDS; // Never go beyond 10, that is uncharted territory (old limit was 5)
allowed = _context.getProperty("router.tunnelConcurrentBuilds", allowed); allowed = _context.getProperty("router.tunnelConcurrentBuilds", allowed);
// expire any REALLY old requests // expire any REALLY old requests
@@ -319,6 +319,11 @@ class BuildExecutor implements Runnable {
if ( (mgr == null) || (mgr.getFreeTunnelCount() <= 0) || (mgr.getOutboundTunnelCount() <= 0) ) { if ( (mgr == null) || (mgr.getFreeTunnelCount() <= 0) || (mgr.getOutboundTunnelCount() <= 0) ) {
// we don't have either inbound or outbound tunnels, so don't bother trying to build // we don't have either inbound or outbound tunnels, so don't bother trying to build
// non-zero-hop tunnels // non-zero-hop tunnels
// try to kickstart it to build a fallback, otherwise we may get stuck here for a long time (minutes)
if (mgr.getFreeTunnelCount() <= 0)
mgr.selectInboundTunnel();
if (mgr.getOutboundTunnelCount() <= 0)
mgr.selectOutboundTunnel();
synchronized (_currentlyBuilding) { synchronized (_currentlyBuilding) {
if (!_repoll) { if (!_repoll) {
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
@@ -498,7 +503,7 @@ class BuildExecutor implements Runnable {
*/ */
public void buildComplete(PooledTunnelCreatorConfig cfg, TunnelPool pool) { public void buildComplete(PooledTunnelCreatorConfig cfg, TunnelPool pool) {
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("Build complete for " + cfg); _log.debug("Build complete for " + cfg, new Exception());
pool.buildComplete(cfg); pool.buildComplete(cfg);
if (cfg.getLength() > 1) if (cfg.getLength() > 1)
removeFromBuilding(cfg.getReplyMessageId()); removeFromBuilding(cfg.getReplyMessageId());

View File

@@ -133,10 +133,10 @@ abstract class BuildRequestor {
else else
pairedTunnel = mgr.selectInboundTunnel(pool.getSettings().getDestination(), farEnd); pairedTunnel = mgr.selectInboundTunnel(pool.getSettings().getDestination(), farEnd);
if (pairedTunnel == null) { if (pairedTunnel == null) {
if (log.shouldLog(Log.INFO))
log.info("Couldn't find a paired tunnel for " + cfg + ", fall back on exploratory tunnels for pairing");
if (isInbound) { if (isInbound) {
pairedTunnel = mgr.selectOutboundExploratoryTunnel(farEnd); // random more reliable than closest ??
//pairedTunnel = mgr.selectOutboundExploratoryTunnel(farEnd);
pairedTunnel = mgr.selectOutboundTunnel();
if (pairedTunnel != null && if (pairedTunnel != null &&
pairedTunnel.getLength() <= 1 && pairedTunnel.getLength() <= 1 &&
mgr.getOutboundSettings().getLength() + mgr.getOutboundSettings().getLengthVariance() > 0) { mgr.getOutboundSettings().getLength() + mgr.getOutboundSettings().getLengthVariance() > 0) {
@@ -146,7 +146,9 @@ abstract class BuildRequestor {
pairedTunnel = null; pairedTunnel = null;
} }
} else { } else {
pairedTunnel = mgr.selectInboundExploratoryTunnel(farEnd); // random more reliable than closest ??
//pairedTunnel = mgr.selectInboundExploratoryTunnel(farEnd);
pairedTunnel = mgr.selectInboundTunnel();
if (pairedTunnel != null && if (pairedTunnel != null &&
pairedTunnel.getLength() <= 1 && pairedTunnel.getLength() <= 1 &&
mgr.getInboundSettings().getLength() + mgr.getInboundSettings().getLengthVariance() > 0) { mgr.getInboundSettings().getLength() + mgr.getInboundSettings().getLengthVariance() > 0) {
@@ -154,6 +156,8 @@ abstract class BuildRequestor {
pairedTunnel = null; pairedTunnel = null;
} }
} }
if (pairedTunnel != null && log.shouldLog(Log.INFO))
log.info("Couldn't find a paired tunnel for " + cfg + ", using exploratory tunnel");
} }
} }
if (pairedTunnel == null) { if (pairedTunnel == null) {