diff --git a/router/java/src/net/i2p/router/networkdb/kademlia/FloodfillPeerSelector.java b/router/java/src/net/i2p/router/networkdb/kademlia/FloodfillPeerSelector.java index 05a771bd3e83fdad2a35e80f8fe26d62f0bf5891..af6f067e438594a6d81fc069fa0d31c42d784c0b 100644 --- a/router/java/src/net/i2p/router/networkdb/kademlia/FloodfillPeerSelector.java +++ b/router/java/src/net/i2p/router/networkdb/kademlia/FloodfillPeerSelector.java @@ -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