diff --git a/history.txt b/history.txt index da999adc4b6373491e4a025f21d0233bf121849d..ae56a2a4b3f557473eafe361703cfc40b94e38a6 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,8 @@ +2012-01-16 hottuna + * Router: + - Don't throttle tunnel creation if using a higher + - than default router.maxParticipatingTunnels setting. + 2012-01-16 zzz * Build: Put Implementation-Version in manifests * NetDB: Hopefully fix rare NPE (ticket #589) diff --git a/router/java/src/net/i2p/router/RouterThrottleImpl.java b/router/java/src/net/i2p/router/RouterThrottleImpl.java index ef30690505ba6cdf610f7690e4304f0a7d9e5a46..d801b09edd57ca78305487ef8b337a20f03820f7 100644 --- a/router/java/src/net/i2p/router/RouterThrottleImpl.java +++ b/router/java/src/net/i2p/router/RouterThrottleImpl.java @@ -178,10 +178,13 @@ class RouterThrottleImpl implements RouterThrottle { return TunnelHistory.TUNNEL_REJECT_BANDWIDTH; } } + int numTunnels = _context.tunnelManager().getParticipatingCount(); + int maxTunnels = _context.getProperty(PROP_MAX_TUNNELS, DEFAULT_MAX_TUNNELS); - if (numTunnels > getMinThrottleTunnels()) { + // Throttle tunnels if min. throttle level is exceeded and default max participating tunnels (or fewer) is used. + if ((numTunnels > getMinThrottleTunnels()) && (DEFAULT_MAX_TUNNELS <= maxTunnels)) { double tunnelGrowthFactor = getTunnelGrowthFactor(); Rate avgTunnels = _context.statManager().getRate("tunnel.participatingTunnels").getRate(10*60*1000); if (avgTunnels != null) { @@ -260,11 +263,10 @@ class RouterThrottleImpl implements RouterThrottle { } } - int max = _context.getProperty(PROP_MAX_TUNNELS, DEFAULT_MAX_TUNNELS); - if (numTunnels >= max) { + if (numTunnels >= maxTunnels) { if (_log.shouldLog(Log.WARN)) _log.warn("Refusing tunnel request since we are already participating in " - + numTunnels + " (our max is " + max + ")"); + + numTunnels + " (our max is " + maxTunnels + ")"); _context.statManager().addRateData("router.throttleTunnelMaxExceeded", numTunnels, 0); setTunnelStatus(_x("Rejecting tunnels: Limit reached")); return TunnelHistory.TUNNEL_REJECT_BANDWIDTH;