diff --git a/history.txt b/history.txt index 5e77c3727e..5ad82613ac 100644 --- a/history.txt +++ b/history.txt @@ -1,4 +1,9 @@ -$Id: history.txt,v 1.466 2006/05/01 17:42:24 jrandom Exp $ +$Id: history.txt,v 1.467 2006/05/02 23:30:28 complication Exp $ + +2006-05-03 Complication + * Allow a single build attempt to proceed despite 1-minute overload + only if the 1-second rate shows enough spare bandwidth + (e.g. overload has already eased) 2006-05-02 Complication * Correct a misnamed property in SummaryHelper.java diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 735e6943fe..ed47c4fa43 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -15,9 +15,9 @@ import net.i2p.CoreVersion; * */ public class RouterVersion { - public final static String ID = "$Revision: 1.406 $ $Date: 2006/05/01 17:40:23 $"; + public final static String ID = "$Revision: 1.407 $ $Date: 2006/05/02 23:30:27 $"; public final static String VERSION = "0.6.1.17"; - public final static long BUILD = 5; + public final static long BUILD = 6; public static void main(String args[]) { System.out.println("I2P Router version: " + VERSION + "-" + BUILD); System.out.println("Router ID: " + RouterVersion.ID); diff --git a/router/java/src/net/i2p/router/tunnel/pool/BuildExecutor.java b/router/java/src/net/i2p/router/tunnel/pool/BuildExecutor.java index 7abea64095..250c865b06 100644 --- a/router/java/src/net/i2p/router/tunnel/pool/BuildExecutor.java +++ b/router/java/src/net/i2p/router/tunnel/pool/BuildExecutor.java @@ -46,6 +46,9 @@ class BuildExecutor implements Runnable { _handler = new BuildHandler(ctx, this); } + // Estimated cost of one tunnel build attempt, bytes + private static final int BUILD_BANDWIDTH_ESTIMATE_BYTES = 5*1024; + private int allowed() { StringBuffer buf = null; if (_log.shouldLog(Log.DEBUG)) { @@ -112,13 +115,23 @@ class BuildExecutor implements Runnable { if (_log.shouldLog(Log.WARN)) _log.warn("Too lagged [" + lag + "], don't allow building"); _context.statManager().addRateData("tunnel.concurrentBuildsLagged", concurrent, lag); - _log.error("Allowed was " + allowed + ", but we had lag issues, so ended up allowing " + Math.min(allowed,1)); - return Math.min(allowed,1); // if we have a job heavily blocking our jobqueue, ssllloowww dddooowwwnnn + return 0; // if we have a job heavily blocking our jobqueue, ssllloowww dddooowwwnnn } if (isOverloaded()) { - _log.error("Allowed was " + allowed + ", but we were overloaded, so ended up allowing " + Math.min(allowed,1)); - return Math.min(allowed,1); + int used1s = _context.router().get1sRate(true); + // If 1-second average indicates we could manage building one tunnel + if ((maxKBps*1024) - used1s > BUILD_BANDWIDTH_ESTIMATE_BYTES) { + // Allow one + if (_log.shouldLog(Log.WARN)) + _log.warn("We had overload, but 1s bandwidth was " + used1s + " so allowed building 1."); + return 1; + } else { + // Allow none + if (_log.shouldLog(Log.WARN)) + _log.warn("We had serious overload, so allowed building 0."); + return 0; + } } return allowed;