- Adjust response time limit

This commit is contained in:
zzz
2009-11-21 13:47:51 +00:00
parent 6bdf750c19
commit e9f9e0dabb

View File

@ -19,6 +19,7 @@ import net.i2p.data.Hash;
import net.i2p.data.RouterInfo;
import net.i2p.router.RouterContext;
import net.i2p.router.peermanager.PeerProfile;
import net.i2p.stat.Rate;
import net.i2p.util.Log;
/**
@ -26,6 +27,9 @@ import net.i2p.util.Log;
* selecting floodfills closest to a given key for
* searches and stores.
*
* Warning - most methods taking a key as an argument require the
* routing key, not the original key.
*
*/
class FloodfillPeerSelector extends PeerSelector {
public FloodfillPeerSelector(RouterContext ctx) { super(ctx); }
@ -135,8 +139,12 @@ class FloodfillPeerSelector extends PeerSelector {
_log.debug("Old: " + entry);
} else {
PeerProfile prof = _context.profileOrganizer().getProfile(entry);
double maxGoodRespTime = MAX_GOOD_RESP_TIME;
Rate tunnelTestTime = _context.statManager().getRate("tunnel.testSuccessTime").getRate(10*60*1000);
if (tunnelTestTime != null && tunnelTestTime.getAverageValue() > 500)
maxGoodRespTime = 2 * tunnelTestTime.getAverageValue();
if (prof != null && prof.getDBHistory() != null
&& ((int) prof.getDbResponseTime().getRate(10*60*1000).getAverageValue()) < MAX_GOOD_RESP_TIME
&& prof.getDbResponseTime().getRate(10*60*1000).getAverageValue() < maxGoodRespTime
&& prof.getDBHistory().getLastStoreFailed() < now - NO_FAIL_STORE_GOOD
&& prof.getDBHistory().getLastLookupFailed() < now - NO_FAIL_LOOKUP_GOOD) {
// good