2006-03-21 jrandom
* Avoid a very strange (unconfirmed) bug that people using the systray's browser picker dialog could cause by disabling the GUI-based browser picker. * Cut down on subsequent streaming lib reset packets transmitted * Use a larger MTU more often * Allow netDb searches to query shitlisted peers, as the queries are indirect. * Add an option to disable non-floodfill netDb searches (non-floodfill searches are used by default, but can be disabled by adding netDb.floodfillOnly=true to the advanced config)
This commit is contained in:
@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
|
||||
*
|
||||
*/
|
||||
public class RouterVersion {
|
||||
public final static String ID = "$Revision: 1.376 $ $Date: 2006/03/18 19:23:23 $";
|
||||
public final static String ID = "$Revision: 1.377 $ $Date: 2006/03/20 00:31:13 $";
|
||||
public final static String VERSION = "0.6.1.12";
|
||||
public final static long BUILD = 14;
|
||||
public final static long BUILD = 15;
|
||||
public static void main(String args[]) {
|
||||
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
||||
System.out.println("Router ID: " + RouterVersion.ID);
|
||||
|
@ -74,13 +74,14 @@ class FloodfillPeerSelector extends PeerSelector {
|
||||
return;
|
||||
if (entry.equals(_context.routerHash()))
|
||||
return;
|
||||
if (_context.shitlist().isShitlisted(entry))
|
||||
return;
|
||||
// it isn't direct, so who cares if they're shitlisted
|
||||
//if (_context.shitlist().isShitlisted(entry))
|
||||
// return;
|
||||
RouterInfo info = _context.netDb().lookupRouterInfoLocally(entry);
|
||||
if (info == null)
|
||||
return;
|
||||
//if (info == null)
|
||||
// return;
|
||||
|
||||
if (FloodfillNetworkDatabaseFacade.isFloodfill(info)) {
|
||||
if (info != null && FloodfillNetworkDatabaseFacade.isFloodfill(info)) {
|
||||
_floodfillMatches.add(entry);
|
||||
} else {
|
||||
if ( (_wanted > _matches) && (_key != null) ) {
|
||||
|
@ -133,6 +133,12 @@ class SearchJob extends JobImpl {
|
||||
public long getExpiration() { return _expiration; }
|
||||
public long getTimeoutMs() { return _timeoutMs; }
|
||||
|
||||
private static final boolean DEFAULT_FLOODFILL_ONLY = false;
|
||||
|
||||
protected boolean onlyQueryFloodfillPeers() {
|
||||
return Boolean.valueOf(getContext().getProperty("netDb.floodfillOnly", DEFAULT_FLOODFILL_ONLY + "")).booleanValue();
|
||||
}
|
||||
|
||||
private static final int PER_FLOODFILL_PEER_TIMEOUT = 10*1000;
|
||||
|
||||
protected int getPerPeerTimeoutMs(Hash peer) {
|
||||
@ -245,6 +251,14 @@ class SearchJob extends JobImpl {
|
||||
int sent = 0;
|
||||
Set attempted = _state.getAttempted();
|
||||
while (sent <= 0) {
|
||||
boolean onlyFloodfill = onlyQueryFloodfillPeers();
|
||||
if (_floodfillPeersExhausted && onlyFloodfill && _state.getPending().size() <= 0) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn(getJobId() + ": no non-floodfill peers left, and no more pending. Searched: "
|
||||
+ _state.getAttempted().size() + " failed: " + _state.getFailed().size());
|
||||
fail();
|
||||
return;
|
||||
}
|
||||
List closestHashes = getClosestRouters(_state.getTarget(), toCheck, attempted);
|
||||
if ( (closestHashes == null) || (closestHashes.size() <= 0) ) {
|
||||
if (_state.getPending().size() <= 0) {
|
||||
@ -278,10 +292,13 @@ class SearchJob extends JobImpl {
|
||||
_state.replyTimeout(peer);
|
||||
} else {
|
||||
RouterInfo ri = (RouterInfo)ds;
|
||||
if (!FloodfillNetworkDatabaseFacade.isFloodfill(ri))
|
||||
if (!FloodfillNetworkDatabaseFacade.isFloodfill(ri)) {
|
||||
_floodfillPeersExhausted = true;
|
||||
if (ri.isHidden() ||
|
||||
getContext().shitlist().isShitlisted(peer)) {
|
||||
if (onlyFloodfill)
|
||||
continue;
|
||||
}
|
||||
if (ri.isHidden()) {// || // allow querying shitlisted, since its indirect
|
||||
//getContext().shitlist().isShitlisted(peer)) {
|
||||
// dont bother
|
||||
} else {
|
||||
_state.addPending(peer);
|
||||
|
@ -117,7 +117,8 @@ public class OutboundEstablishState {
|
||||
|
||||
public void addMessage(OutNetMessage msg) {
|
||||
synchronized (_queuedMessages) {
|
||||
_queuedMessages.add(msg);
|
||||
if (!_queuedMessages.contains(msg))
|
||||
_queuedMessages.add(msg);
|
||||
}
|
||||
}
|
||||
public OutNetMessage getNextQueuedMessage() {
|
||||
|
@ -254,9 +254,9 @@ public class PeerState {
|
||||
_mtuReceive = _mtu;
|
||||
_mtuLastChecked = -1;
|
||||
_lastACKSend = -1;
|
||||
_rtt = 1000;
|
||||
_rto = MIN_RTO;
|
||||
_rtt = _rto/2;
|
||||
_rttDeviation = _rtt;
|
||||
_rto = MAX_RTO;
|
||||
_messagesReceived = 0;
|
||||
_messagesSent = 0;
|
||||
_packetsTransmitted = 0;
|
||||
@ -874,7 +874,7 @@ public class PeerState {
|
||||
double retransPct = 0;
|
||||
if (_packetsTransmitted > 10) {
|
||||
retransPct = (double)_packetsRetransmitted/(double)_packetsTransmitted;
|
||||
boolean wantLarge = retransPct < .25d; // heuristic to allow fairly lossy links to use large MTUs
|
||||
boolean wantLarge = retransPct < .50d; // heuristic to allow fairly lossy links to use large MTUs
|
||||
if (wantLarge && _mtu != LARGE_MTU) {
|
||||
if (_context.random().nextLong(_mtuDecreases) <= 0) {
|
||||
_mtu = LARGE_MTU;
|
||||
@ -943,10 +943,12 @@ public class PeerState {
|
||||
else
|
||||
_consecutiveSmall = 0;
|
||||
|
||||
if ( (_consecutiveSmall < 50) && (_packetsReceived > 50) )
|
||||
_mtuReceive = LARGE_MTU;
|
||||
else
|
||||
_mtuReceive = MIN_MTU;
|
||||
if (_packetsReceived > 50) {
|
||||
if (_consecutiveSmall < 50)
|
||||
_mtuReceive = LARGE_MTU;
|
||||
else
|
||||
_mtuReceive = MIN_MTU;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user