forked from I2P_Developers/i2p.i2p
NetDb: Peer selection tweaks
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
2016-12-01 zzz
|
||||
* NetDb: Peer selection tweaks
|
||||
|
||||
2016-11-27 zzz
|
||||
* NetDb: Add same-port check in peer selector
|
||||
* NetDb:
|
||||
- Add same-port check in peer selector
|
||||
- Add MTU, SSU caps, IPv6 prefix, and cost lookups
|
||||
|
||||
2016-11-26 zzz
|
||||
* NetDb:
|
||||
|
||||
@@ -18,7 +18,7 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Monotone";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 12;
|
||||
public final static long BUILD = 13;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "-rc";
|
||||
|
||||
@@ -171,7 +171,10 @@ class FloodfillPeerSelector extends PeerSelector {
|
||||
private static final int NO_FAIL_LOOKUP_OK = 75*1000;
|
||||
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 long HEARD_AGE = 48*60*60*1000L;
|
||||
// TODO we need better tracking of floodfill first-heard-about times
|
||||
// before we can do this. Old profiles get deleted.
|
||||
//private static final long HEARD_AGE = 48*60*60*1000L;
|
||||
private static final long HEARD_AGE = 60*60*1000L;
|
||||
private static final long INSTALL_AGE = HEARD_AGE + (60*60*1000L);
|
||||
|
||||
/**
|
||||
|
||||
@@ -83,7 +83,7 @@ class IterativeSearchJob extends FloodSearchJob {
|
||||
/** Max number of peers to query if we are ff */
|
||||
private static final int TOTAL_SEARCH_LIMIT_WHEN_FF = 3;
|
||||
/** Extra peers to get from peer selector, as we may discard some before querying */
|
||||
private static final int EXTRA_PEERS = 2;
|
||||
private static final int EXTRA_PEERS = 1;
|
||||
private static final int IP_CLOSE_BYTES = 3;
|
||||
/** TOTAL_SEARCH_LIMIT * SINGLE_SEARCH_TIME, plus some extra */
|
||||
private static final int MAX_SEARCH_TIME = 30*1000;
|
||||
|
||||
@@ -1246,7 +1246,7 @@ public class ProfileOrganizer {
|
||||
*/
|
||||
private void locked_selectPeers(Map<Hash, PeerProfile> peers, int howMany, Set<Hash> toExclude, Set<Hash> matches, int mask) {
|
||||
List<Hash> all = new ArrayList<Hash>(peers.keySet());
|
||||
MaskedIPSet IPSet = new MaskedIPSet(8);
|
||||
MaskedIPSet IPSet = new MaskedIPSet(16);
|
||||
// use RandomIterator to avoid shuffling the whole thing
|
||||
for (Iterator<Hash> iter = new RandomIterator<Hash>(all); (matches.size() < howMany) && iter.hasNext(); ) {
|
||||
Hash peer = iter.next();
|
||||
|
||||
@@ -81,6 +81,8 @@ public class MaskedIPSet extends HashSet<String> {
|
||||
int port = pa.getPort();
|
||||
if (port > 0)
|
||||
add("p" + port);
|
||||
if (pa.getCost() == 2 && "NTCP".equals(pa.getTransportStyle()))
|
||||
add("=cost2");
|
||||
}
|
||||
String family = pinfo.getOption("family");
|
||||
if (family != null) {
|
||||
|
||||
Reference in New Issue
Block a user