don't rip the peer's head off after multiple tunnel rejections - penalize them *once* for the instance (not once *per* instance)

This commit is contained in:
jrandom
2004-07-16 00:15:34 +00:00
committed by zzz
parent 5850ad1217
commit 4381bb5026

View File

@ -1,6 +1,7 @@
package net.i2p.router.peermanager; package net.i2p.router.peermanager;
import net.i2p.router.RouterContext; import net.i2p.router.RouterContext;
import net.i2p.stat.RateStat;
import net.i2p.util.Log; import net.i2p.util.Log;
/** /**
@ -36,27 +37,24 @@ public class ReliabilityCalculator extends Calculator {
//val -= profile.getSendFailureSize().getRate(60*60*1000).getCurrentEventCount()*2; //val -= profile.getSendFailureSize().getRate(60*60*1000).getCurrentEventCount()*2;
//val -= profile.getSendFailureSize().getRate(60*60*1000).getLastEventCount()*2; //val -= profile.getSendFailureSize().getRate(60*60*1000).getLastEventCount()*2;
long rejectionPenalties = RateStat rejRate = profile.getTunnelHistory().getRejectionRate();
(profile.getTunnelHistory().getRejectionRate().getRate(60*1000).getCurrentEventCount() * 200) if (rejRate.getRate(60*1000).getCurrentEventCount() > 0)
+ (profile.getTunnelHistory().getRejectionRate().getRate(60*1000).getLastEventCount() * 100) val -= 200;
+ (profile.getTunnelHistory().getRejectionRate().getRate(10*60*1000).getCurrentEventCount() * 10) if (rejRate.getRate(60*1000).getLastEventCount() > 0)
+ (profile.getTunnelHistory().getRejectionRate().getRate(10*60*1000).getLastEventCount() * 5) val -= 100;
+ (profile.getTunnelHistory().getRejectionRate().getRate(60*60*1000).getCurrentEventCount() * 1); if (rejRate.getRate(10*60*1000).getCurrentEventCount() > 0)
if ( (rejectionPenalties > 0) && (_log.shouldLog(Log.INFO)) ) val -= 10;
_log.info("Rejection penalties for peer " + profile.getPeer().toBase64() + ": " + rejectionPenalties); if (rejRate.getRate(10*60*1000).getCurrentEventCount() > 0)
val -= rejectionPenalties; val -= 5;
//val -= profile.getTunnelHistory().getRejectionRate().getRate(60*60*1000).getLastEventCount() * 1;
// penalize them heavily for dropping netDb requests // penalize them heavily for dropping netDb requests (though these could have
// failed due to tunnel timeouts, so don't be too mean)
if (profile.getDBHistory().getFailedLookupRate().getRate(60*1000).getCurrentEventCount() > 0) if (profile.getDBHistory().getFailedLookupRate().getRate(60*1000).getCurrentEventCount() > 0)
val -= 10; val -= 10;
if (profile.getDBHistory().getFailedLookupRate().getRate(60*1000).getLastEventCount() > 0) if (profile.getDBHistory().getFailedLookupRate().getRate(60*1000).getLastEventCount() > 0)
val -= 5; val -= 5;
//val -= profile.getDBHistory().getFailedLookupRate().getRate(60*60*1000).getCurrentEventCount();
//val -= profile.getDBHistory().getFailedLookupRate().getRate(60*60*1000).getLastEventCount();
//val -= profile.getDBHistory().getFailedLookupRate().getRate(24*60*60*1000).getCurrentEventCount() * 50;
//val -= profile.getDBHistory().getFailedLookupRate().getRate(24*60*60*1000).getLastEventCount() * 20;
// scream and shout on network errors
if (profile.getCommError().getRate(60*1000).getCurrentEventCount() > 0) if (profile.getCommError().getRate(60*1000).getCurrentEventCount() > 0)
val -= 200; val -= 200;
if (profile.getCommError().getRate(60*1000).getLastEventCount() > 0) if (profile.getCommError().getRate(60*1000).getLastEventCount() > 0)