forked from I2P_Developers/i2p.i2p
reduce the grace period from 5 to 2 minutes, which will cause us to test peers more often
also add some logging (log level == debug will display why we mark a peer as failing)
This commit is contained in:
@@ -20,8 +20,8 @@ public class IsFailingCalculator extends Calculator {
|
|||||||
private Log _log;
|
private Log _log;
|
||||||
private RouterContext _context;
|
private RouterContext _context;
|
||||||
|
|
||||||
/** if they haven't b0rked in the last 5 minutes, they're ok */
|
/** if they haven't b0rked in the last 2 minutes, they're ok */
|
||||||
private final static long GRACE_PERIOD = 5*60*1000;
|
private final static long GRACE_PERIOD = 2*60*1000;
|
||||||
|
|
||||||
public IsFailingCalculator(RouterContext context) {
|
public IsFailingCalculator(RouterContext context) {
|
||||||
_context = context;
|
_context = context;
|
||||||
@@ -32,6 +32,9 @@ public class IsFailingCalculator extends Calculator {
|
|||||||
// have we failed in the last 119 seconds?
|
// have we failed in the last 119 seconds?
|
||||||
if ( (profile.getCommError().getRate(60*1000).getCurrentEventCount() > 0) ||
|
if ( (profile.getCommError().getRate(60*1000).getCurrentEventCount() > 0) ||
|
||||||
(profile.getCommError().getRate(60*1000).getLastEventCount() > 0) ) {
|
(profile.getCommError().getRate(60*1000).getLastEventCount() > 0) ) {
|
||||||
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
|
_log.debug("Peer " + profile.getPeer().toBase64()
|
||||||
|
+ " is failing because it had a comm error in the last 2 minutes");
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
//if ( (profile.getDBHistory().getFailedLookupRate().getRate(60*1000).getCurrentEventCount() > 0) ||
|
//if ( (profile.getDBHistory().getFailedLookupRate().getRate(60*1000).getCurrentEventCount() > 0) ||
|
||||||
@@ -44,16 +47,26 @@ public class IsFailingCalculator extends Calculator {
|
|||||||
|
|
||||||
if (profile.getTunnelHistory().getLastRejected() >= recently) {
|
if (profile.getTunnelHistory().getLastRejected() >= recently) {
|
||||||
// have they refused to participate in a tunnel in the last 5 minutes?
|
// have they refused to participate in a tunnel in the last 5 minutes?
|
||||||
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
|
_log.debug("Peer " + profile.getPeer().toBase64()
|
||||||
|
+ " is failing because it refused to participate in a tunnel in the last few minutes");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profile.getTunnelHistory().getLastFailed() >= recently) {
|
if (profile.getTunnelHistory().getLastFailed() >= recently) {
|
||||||
// has a tunnel they participate in failed in the last 5 minutes?
|
// has a tunnel they participate in failed in the last 5 minutes?
|
||||||
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
|
_log.debug("Peer " + profile.getPeer().toBase64()
|
||||||
|
+ " is failing because it one of their tunnels failed in the last few minutes");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profile.getLastSendFailed() >= recently)
|
if (profile.getLastSendFailed() >= recently) {
|
||||||
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
|
_log.debug("Peer " + profile.getPeer().toBase64()
|
||||||
|
+ " is failing because we couldnt send to it recently");
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user