* Tunnel Testing:
- Fix counting so it really takes 4 consecutive failures rather than 4 total to remove a tunnel - Credit or blame goes to the exploratory tunnel as well as the tunnel being tested - Adjust tunnel test timeout based on tunnel length * ExploratoryPeerSelector: Tweak logging * ProfileOrganizer: Adjust integration calculation again * build.xml: Add to help * checklist.txt: Tweak * readme.html: Fix forum links * netDb: Remove tunnel.testFailedTime
This commit is contained in:
@ -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);
|
||||
|
@ -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 });
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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() {
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user