merge of 'a5d2fae48cf001c84ff5cea42466e1f3ed7d5f0a'

and 'c52409bf5d7b422c23a62eecfa50b98d7c74f8df'
This commit is contained in:
str4d
2012-01-17 03:04:52 +00:00
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-16 zzz
* Build: Put Implementation-Version in manifests
* NetDB: Hopefully fix rare NPE (ticket #589)

View File

@ -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;