* FloodfillPeerSelector: Adjust rankings to try to

improve LeaseSet lookups
This commit is contained in:
zzz
2010-03-31 18:33:08 +00:00
parent 55e45c4274
commit 71aa0cfba7

View File

@ -112,7 +112,7 @@ class FloodfillPeerSelector extends PeerSelector {
private static final int NO_FAIL_STORE_OK = 10*60*1000; private static final int NO_FAIL_STORE_OK = 10*60*1000;
private static final int NO_FAIL_STORE_GOOD = NO_FAIL_STORE_OK * 2; private static final int NO_FAIL_STORE_GOOD = NO_FAIL_STORE_OK * 2;
/** this must be longer than the max streaming timeout (60s) */ /** this must be longer than the max streaming timeout (60s) */
private static final int NO_FAIL_LOOKUP_OK = 2*60*1000; private static final int NO_FAIL_LOOKUP_OK = 3*60*1000;
private static final int NO_FAIL_LOOKUP_GOOD = NO_FAIL_LOOKUP_OK * 3; private static final int NO_FAIL_LOOKUP_GOOD = NO_FAIL_LOOKUP_OK * 3;
private static final int MAX_GOOD_RESP_TIME = 5*1000; private static final int MAX_GOOD_RESP_TIME = 5*1000;
@ -135,8 +135,11 @@ class FloodfillPeerSelector extends PeerSelector {
maxFailRate = 100d; // disable maxFailRate = 100d; // disable
} }
// 8 == FNDF.MAX_TO_FLOOD + 1
int limit = Math.max(8, howMany);
limit = Math.min(limit, ffs.size());
// split sorted list into 3 sorted lists // split sorted list into 3 sorted lists
for (int i = 0; found < howMany && i < ffs.size(); i++) { for (int i = 0; found < howMany && i < limit; i++) {
Hash entry = sorted.first(); Hash entry = sorted.first();
sorted.remove(entry); sorted.remove(entry);
if (entry == null) if (entry == null)