I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 47d5e44b authored by zzz's avatar zzz
Browse files

* Throttle: Reduce default max tunnels to 2000 (was 2500)

parent f6996c7d
No related branches found
No related tags found
No related merge requests found
...@@ -31,7 +31,7 @@ class RouterThrottleImpl implements RouterThrottle { ...@@ -31,7 +31,7 @@ class RouterThrottleImpl implements RouterThrottle {
private static int THROTTLE_EVENT_LIMIT = 30; private static int THROTTLE_EVENT_LIMIT = 30;
private static final String PROP_MAX_TUNNELS = "router.maxParticipatingTunnels"; private static final String PROP_MAX_TUNNELS = "router.maxParticipatingTunnels";
private static final String DEFAULT_MAX_TUNNELS = "2500"; // Unless share BW > 250KBps, BW limit will kick in first private static final int DEFAULT_MAX_TUNNELS = 2000;
private static final String PROP_DEFAULT_KBPS_THROTTLE = "router.defaultKBpsThrottle"; private static final String PROP_DEFAULT_KBPS_THROTTLE = "router.defaultKBpsThrottle";
/** tunnel acceptance */ /** tunnel acceptance */
...@@ -190,21 +190,22 @@ class RouterThrottleImpl implements RouterThrottle { ...@@ -190,21 +190,22 @@ class RouterThrottleImpl implements RouterThrottle {
} }
} }
String maxTunnels = _context.getProperty(PROP_MAX_TUNNELS, DEFAULT_MAX_TUNNELS); int max = DEFAULT_MAX_TUNNELS;
String maxTunnels = _context.getProperty(PROP_MAX_TUNNELS);
if (maxTunnels != null) { if (maxTunnels != null) {
try { try {
int max = Integer.parseInt(maxTunnels); max = Integer.parseInt(maxTunnels);
if (numTunnels >= max) {
if (_log.shouldLog(Log.WARN))
_log.warn("Refusing tunnel request since we are already participating in "
+ numTunnels + " (our max is " + max + ")");
_context.statManager().addRateData("router.throttleTunnelMaxExceeded", numTunnels, 0);
setTunnelStatus("Rejecting tunnels: Limit reached");
return TunnelHistory.TUNNEL_REJECT_BANDWIDTH;
}
} catch (NumberFormatException nfe) { } catch (NumberFormatException nfe) {
} }
} }
if (numTunnels >= max) {
if (_log.shouldLog(Log.WARN))
_log.warn("Refusing tunnel request since we are already participating in "
+ numTunnels + " (our max is " + max + ")");
_context.statManager().addRateData("router.throttleTunnelMaxExceeded", numTunnels, 0);
setTunnelStatus("Rejecting tunnels: Limit reached");
return TunnelHistory.TUNNEL_REJECT_BANDWIDTH;
}
// ok, we're not hosed, but can we handle the bandwidth requirements // ok, we're not hosed, but can we handle the bandwidth requirements
// of another tunnel? // of another tunnel?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment