diff --git a/build.xml b/build.xml
index fd9229ce3..a6ac3f787 100644
--- a/build.xml
+++ b/build.xml
@@ -3,7 +3,8 @@
As a note, you can change this page by editing the file "docs/readme.html"
diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 6cade9a88..6e4eccab0 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -17,7 +17,7 @@ import net.i2p.CoreVersion; public class RouterVersion { public final static String ID = "$Revision: 1.548 $ $Date: 2008-02-10 15:00:00 $"; public final static String VERSION = "0.6.1.32"; - public final static long BUILD = 8; + public final static long BUILD = 9; 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/StatisticsManager.java b/router/java/src/net/i2p/router/StatisticsManager.java index f3fdb7a40..867c22022 100644 --- a/router/java/src/net/i2p/router/StatisticsManager.java +++ b/router/java/src/net/i2p/router/StatisticsManager.java @@ -136,6 +136,7 @@ public class StatisticsManager implements Service { //includeRate("tunnel.fragmentedDropped", stats, new long[] { 10*60*1000, 3*60*60*1000 }); //includeRate("tunnel.fullFragments", stats, new long[] { 10*60*1000, 3*60*60*1000 }); //includeRate("tunnel.smallFragments", stats, new long[] { 10*60*1000, 3*60*60*1000 }); + if (commentMeOutInDot33) includeRate("tunnel.testFailedTime", stats, new long[] { 10*60*1000 }); includeRate("tunnel.buildFailure", stats, new long[] { 60*60*1000 }); diff --git a/router/java/src/net/i2p/router/peermanager/IntegrationCalculator.java b/router/java/src/net/i2p/router/peermanager/IntegrationCalculator.java index 245ce2f08..26aa2b911 100644 --- a/router/java/src/net/i2p/router/peermanager/IntegrationCalculator.java +++ b/router/java/src/net/i2p/router/peermanager/IntegrationCalculator.java @@ -20,9 +20,10 @@ public class IntegrationCalculator extends Calculator { public double calc(PeerProfile profile) { // give more weight to recent counts long val = profile.getDbIntroduction().getRate(24*60*60*1000l).getCurrentEventCount(); - val += 2 * 4 * profile.getDbIntroduction().getRate(6*60*60*1000l).getCurrentEventCount(); + val += 2 * 4 * profile.getDbIntroduction().getRate(6*60*60*1000l).getLastEventCount(); + val += 3 * 4 * profile.getDbIntroduction().getRate(6*60*60*1000l).getCurrentEventCount(); val += 4 * 24 * profile.getDbIntroduction().getRate(60*60*1000l).getCurrentEventCount(); - val /= 7; + val /= 10; val += profile.getIntegrationBonus(); return val; } diff --git a/router/java/src/net/i2p/router/tunnel/TunnelCreatorConfig.java b/router/java/src/net/i2p/router/tunnel/TunnelCreatorConfig.java index d79891983..6eb3be068 100644 --- a/router/java/src/net/i2p/router/tunnel/TunnelCreatorConfig.java +++ b/router/java/src/net/i2p/router/tunnel/TunnelCreatorConfig.java @@ -137,10 +137,11 @@ public class TunnelCreatorConfig implements TunnelInfo { } + // Make configurable? - but can't easily get to pool options from here private static final int MAX_CONSECUTIVE_TEST_FAILURES = 3; /** - * The tunnel failed, so stop using it + * The tunnel failed a test, so (maybe) stop using it */ public boolean tunnelFailed() { _failures++; @@ -155,11 +156,8 @@ public class TunnelCreatorConfig implements TunnelInfo { public int getTunnelFailures() { return _failures; } public void testSuccessful(int ms) { - int failures = _failures - 1; - if (failures < 0) + if (!_failed) _failures = 0; - else - _failures = failures; } public String toString() { diff --git a/router/java/src/net/i2p/router/tunnel/pool/ExploratoryPeerSelector.java b/router/java/src/net/i2p/router/tunnel/pool/ExploratoryPeerSelector.java index cbd6cd7d6..2daf1f6b3 100644 --- a/router/java/src/net/i2p/router/tunnel/pool/ExploratoryPeerSelector.java +++ b/router/java/src/net/i2p/router/tunnel/pool/ExploratoryPeerSelector.java @@ -73,13 +73,13 @@ class ExploratoryPeerSelector extends TunnelPeerSelector { failPct = 100 - MIN_NONFAILING_PCT; } else { failPct = getExploratoryFailPercentage(ctx); + Log l = ctx.logManager().getLog(getClass()); + if (l.shouldLog(Log.DEBUG)) + l.debug("Fail pct: " + failPct); // always try a little, this helps keep the failPct stat accurate too if (failPct > 100 - MIN_NONFAILING_PCT) failPct = 100 - MIN_NONFAILING_PCT; } - Log l = ctx.logManager().getLog(getClass()); - if (l.shouldLog(Log.DEBUG)) - l.error("Fail pct: " + failPct); return (failPct >= ctx.random().nextInt(100)); } diff --git a/router/java/src/net/i2p/router/tunnel/pool/PooledTunnelCreatorConfig.java b/router/java/src/net/i2p/router/tunnel/pool/PooledTunnelCreatorConfig.java index c3ae88e47..a252e26a1 100644 --- a/router/java/src/net/i2p/router/tunnel/pool/PooledTunnelCreatorConfig.java +++ b/router/java/src/net/i2p/router/tunnel/pool/PooledTunnelCreatorConfig.java @@ -29,6 +29,7 @@ public class PooledTunnelCreatorConfig extends TunnelCreatorConfig { _live = false; } + // calls TestJob public void testSuccessful(int ms) { if (_testJob != null) _testJob.testSuccessful(ms); @@ -36,8 +37,14 @@ public class PooledTunnelCreatorConfig extends TunnelCreatorConfig { _live = true; } + // called from TestJob + public void testJobSuccessful(int ms) { + super.testSuccessful(ms); + _live = true; + } + /** - * The tunnel failed, so stop using it + * The tunnel failed a test, so (maybe) stop using it */ public boolean tunnelFailed() { boolean rv = super.tunnelFailed(); diff --git a/router/java/src/net/i2p/router/tunnel/pool/TestJob.java b/router/java/src/net/i2p/router/tunnel/pool/TestJob.java index 55080c269..91d8a8044 100644 --- a/router/java/src/net/i2p/router/tunnel/pool/TestJob.java +++ b/router/java/src/net/i2p/router/tunnel/pool/TestJob.java @@ -27,6 +27,7 @@ class TestJob extends JobImpl { private boolean _found; private TunnelInfo _outTunnel; private TunnelInfo _replyTunnel; + private PooledTunnelCreatorConfig _otherTunnel; /** base to randomize the test delay on */ private static final int TEST_DELAY = 30*1000; @@ -78,9 +79,11 @@ class TestJob extends JobImpl { if (_cfg.isInbound()) { _replyTunnel = _cfg; _outTunnel = getContext().tunnelManager().selectOutboundTunnel(); + _otherTunnel = (PooledTunnelCreatorConfig) _outTunnel; } else { _replyTunnel = getContext().tunnelManager().selectInboundTunnel(); _outTunnel = _cfg; + _otherTunnel = (PooledTunnelCreatorConfig) _replyTunnel; } if ( (_replyTunnel == null) || (_outTunnel == null) ) { @@ -156,6 +159,13 @@ class TestJob extends JobImpl { noteSuccess(ms, _outTunnel); noteSuccess(ms, _replyTunnel); + _cfg.testJobSuccessful(ms); + // credit the expl. tunnel too + if (_otherTunnel.getLength() > 1) + _otherTunnel.testJobSuccessful(ms); + + if (_log.shouldLog(Log.DEBUG)) + _log.debug("Tunnel test successful in " + ms + "ms: " + _cfg); scheduleRetest(); } @@ -178,6 +188,9 @@ class TestJob extends JobImpl { if (_log.shouldLog(Log.WARN)) _log.warn("Tunnel test failed in " + timeToFail + "ms: " + _cfg); boolean keepGoing = _cfg.tunnelFailed(); + // blame the expl. tunnel too + if (_otherTunnel.getLength() > 1) + _otherTunnel.tunnelFailed(); if (keepGoing) { scheduleRetest(true); } else { @@ -190,8 +203,18 @@ class TestJob extends JobImpl { /** randomized time we should wait before testing */ private int getDelay() { return TEST_DELAY + getContext().random().nextInt(TEST_DELAY); } + /** how long we allow tests to run for before failing them */ - private int getTestPeriod() { return 15*1000; } + private int getTestPeriod() { + if (_outTunnel == null || _replyTunnel == null) + return 15*1000; + // Give it 2.5s per hop + 5s (2 hop tunnel = length 3, so this will be 15s for two 2-hop tunnels) + // Minimum is 7.5s (since a 0-hop could be the expl. tunnel, but only >= 1-hop client tunnels are tested) + // Network average for success is about 1.5s. + // Another possibility - make configurable via pool options + return 2500 * (_outTunnel.getLength() + _replyTunnel.getLength()); + } + private void scheduleRetest() { scheduleRetest(false); } private void scheduleRetest(boolean asap) { if (asap) { @@ -286,4 +309,4 @@ class TestJob extends JobImpl { return rv.toString(); } } -} \ No newline at end of file +}