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

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

NetDB: Increase closest-floodfill search size

Reduce max fail rate
Lookup RIs more efficiently
parent 981946c9
No related branches found
No related tags found
No related merge requests found
......@@ -223,20 +223,20 @@ class FloodfillPeerSelector extends PeerSelector {
long installed = _context.getProperty("router.firstInstalled", 0L);
boolean enforceHeard = installed > 0 && (now - installed) > INSTALL_AGE;
double maxFailRate = 100;
double maxFailRate = 0.95;
if (_context.router().getUptime() > 60*60*1000) {
RateStat rs = _context.statManager().getRate("peer.failedLookupRate");
if (rs != null) {
Rate r = rs.getRate(60*60*1000);
if (r != null) {
double currentFailRate = r.getAverageValue();
maxFailRate = Math.max(0.20d, 1.5d * currentFailRate);
maxFailRate = Math.min(0.95d, Math.max(0.20d, 1.25d * currentFailRate));
}
}
}
// 5 == FNDF.MAX_TO_FLOOD + 1
int limit = Math.max(5, howMany + 2);
int limit = Math.max(5, howMany * 2);
limit = Math.min(limit, sorted.size());
MaskedIPSet maskedIPs = new MaskedIPSet(limit * 3);
// split sorted list into 3 sorted lists
......@@ -248,7 +248,7 @@ class FloodfillPeerSelector extends PeerSelector {
if (entry == null)
break; // shouldn't happen
// put anybody in the same /16 at the end
RouterInfo info = _context.netDb().lookupRouterInfoLocally(entry);
RouterInfo info = (RouterInfo) _context.netDb().lookupLocallyWithoutValidation(entry);
MaskedIPSet entryIPs = new MaskedIPSet(_context, entry, info, 2);
boolean sameIP = false;
for (String ip : entryIPs) {
......@@ -373,7 +373,7 @@ class FloodfillPeerSelector extends PeerSelector {
// ... unless they are really bad
if (_context.banlist().isBanlistedForever(entry))
return;
RouterInfo info = _context.netDb().lookupRouterInfoLocally(entry);
RouterInfo info = (RouterInfo) _context.netDb().lookupLocallyWithoutValidation(entry);
//if (info == null)
// return;
......@@ -419,7 +419,7 @@ class FloodfillPeerSelector extends PeerSelector {
// (Forever banlisted ones are excluded in add() above)
for (Iterator<Hash> iter = new RandomIterator<Hash>(_floodfillMatches); (found < howMany) && iter.hasNext(); ) {
Hash entry = iter.next();
RouterInfo info = _context.netDb().lookupRouterInfoLocally(entry);
RouterInfo info = (RouterInfo) _context.netDb().lookupLocallyWithoutValidation(entry);
if (info != null && now - info.getPublished() > 3*60*60*1000) {
badff.add(entry);
if (_log.shouldLog(Log.DEBUG))
......
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