I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit e9f9e0da authored by zzz's avatar zzz
Browse files

- Adjust response time limit

parent 6bdf750c
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment