From edaf7aee5d9bcb0440b99942f5b7cdd8b20e07c4 Mon Sep 17 00:00:00 2001 From: jrandom Date: Sun, 25 Jul 2004 23:46:55 +0000 Subject: [PATCH] * for the moment, remove the 'isFailing' check for peers who have failing tunnels (we need a more sophisticated algorithm than the one in place for it to be effective) * fix for the profileOrganizer to work safely in the sim --- .../peermanager/IsFailingCalculator.java | 20 ++++++++++++------- .../router/peermanager/ProfileOrganizer.java | 4 ++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/router/java/src/net/i2p/router/peermanager/IsFailingCalculator.java b/router/java/src/net/i2p/router/peermanager/IsFailingCalculator.java index 728487762..a81071990 100644 --- a/router/java/src/net/i2p/router/peermanager/IsFailingCalculator.java +++ b/router/java/src/net/i2p/router/peermanager/IsFailingCalculator.java @@ -54,13 +54,19 @@ public class IsFailingCalculator extends Calculator { return true; } - Rate failedRate = profile.getTunnelHistory().getFailedRate().getRate(60*1000); - if (failedRate.getCurrentEventCount() >= 2) { - if (_log.shouldLog(Log.DEBUG)) - _log.debug("Peer " + profile.getPeer().toBase64() - + " is failing because too many of their tunnels failed recently"); - return true; - } + //// + // the right way to behave would be to use some statistical + // analysis on the failure rate, and only mark the peer as failing + // if their rate exceeded the expected rate (mean, median, stddev, etc) + //// + + //Rate failedRate = profile.getTunnelHistory().getFailedRate().getRate(60*1000); + //if (failedRate.getCurrentEventCount() >= 2) { + // if (_log.shouldLog(Log.DEBUG)) + // _log.debug("Peer " + profile.getPeer().toBase64() + // + " is failing because too many of their tunnels failed recently"); + // return true; + //} return false; } diff --git a/router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java b/router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java index 526c5df99..3c0a7ae8a 100644 --- a/router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java +++ b/router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java @@ -146,8 +146,8 @@ public class ProfileOrganizer { * Add the new profile, returning the old value (or null if no profile existed) * */ - public PeerProfile addProfile(PeerProfile profile) { - if ( (profile == null) || (profile.getPeer() == null) || (_us.equals(profile.getPeer())) ) return null; + public PeerProfile addProfile(PeerProfile profile) throws IllegalStateException { + if ( (profile == null) || (profile.getPeer() == null) ) return null; if (_log.shouldLog(Log.DEBUG)) _log.debug("New profile created for " + profile.getPeer().toBase64());