Don't throttle tunnel creation if using a higher than default router.maxParticipatingTunnels setting.

This commit is contained in:
dev
2012-01-16 20:09:34 +00:00
parent 2253ad13cc
commit b1878d6026
2 changed files with 11 additions and 4 deletions

View File

@ -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-14 zzz
* i2ptunnel: Partial fix for dest formatting (ticket #581)
* jars.jsp: New debug page

View File

@ -179,9 +179,12 @@ class RouterThrottleImpl implements RouterThrottle {
}
}
int numTunnels = _context.tunnelManager().getParticipatingCount();
if (numTunnels > getMinThrottleTunnels()) {
int numTunnels = _context.tunnelManager().getParticipatingCount();
int maxTunnels = _context.getProperty(PROP_MAX_TUNNELS, DEFAULT_MAX_TUNNELS);
// 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;