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:
jrandom
2006-03-21 23:11:32 +00:00
committed by zzz
parent 343748111a
commit c5aab8c750
9 changed files with 71 additions and 22 deletions

View File

@ -46,7 +46,9 @@ public class StatSummarizer implements Runnable {
",router.activeSendPeers.60000" + ",router.activeSendPeers.60000" +
",tunnel.acceptLoad.60000" + ",tunnel.acceptLoad.60000" +
",client.sendAckTime.60000" + ",client.sendAckTime.60000" +
",client.dispatchNoACK.60000"; ",client.dispatchNoACK.60000" +
",transport.sendMessageFailureLifetime.60000" +
",transport.sendProcessingTime.60000";
private String adjustDatabases(String oldSpecs) { private String adjustDatabases(String oldSpecs) {
String spec = _context.getProperty("stat.summaries", DEFAULT_DATABASES); String spec = _context.getProperty("stat.summaries", DEFAULT_DATABASES);

View File

@ -210,6 +210,11 @@ public class Connection {
} }
} }
if (packet != null) { if (packet != null) {
if (packet.isFlagSet(Packet.FLAG_RESET)) {
// sendReset takes care to prevent too-frequent RSET transmissions
sendReset();
return;
}
ResendPacketEvent evt = (ResendPacketEvent)packet.getResendEvent(); ResendPacketEvent evt = (ResendPacketEvent)packet.getResendEvent();
if (evt != null) { if (evt != null) {
boolean sent = evt.retransmit(false); boolean sent = evt.retransmit(false);
@ -240,9 +245,11 @@ public class Connection {
_disconnectScheduledOn = _context.clock().now(); _disconnectScheduledOn = _context.clock().now();
SimpleTimer.getInstance().addEvent(new DisconnectEvent(), DISCONNECT_TIMEOUT); SimpleTimer.getInstance().addEvent(new DisconnectEvent(), DISCONNECT_TIMEOUT);
} }
long now = _context.clock().now();
if (_resetSentOn + 10*1000 > now) return; // don't send resets too fast
_resetSent = true; _resetSent = true;
if (_resetSentOn <= 0) if (_resetSentOn <= 0)
_resetSentOn = _context.clock().now(); _resetSentOn = now;
if ( (_remotePeer == null) || (_sendStreamId <= 0) ) return; if ( (_remotePeer == null) || (_sendStreamId <= 0) ) return;
PacketLocal reply = new PacketLocal(_context, _remotePeer); PacketLocal reply = new PacketLocal(_context, _remotePeer);
reply.setFlag(Packet.FLAG_RESET); reply.setFlag(Packet.FLAG_RESET);

View File

@ -169,7 +169,14 @@ public class SysTray implements SysTrayMenuListener {
_itemOpenConsole.addSysTrayMenuListener(this); _itemOpenConsole.addSysTrayMenuListener(this);
// _sysTrayMenu.addItem(_itemShutdown); // _sysTrayMenu.addItem(_itemShutdown);
// _sysTrayMenu.addSeparator(); // _sysTrayMenu.addSeparator();
_sysTrayMenu.addItem(_itemSelectBrowser); // hide it, as there have been reports of b0rked behavior on some JVMs.
// specifically, that on XP & sun1.5.0.1, a user launching i2p w/out the
// service wrapper would create netDb/, peerProfiles/, and other files
// underneath each directory browsed to - as if the router's "." directory
// is changing whenever the itemSelectBrowser's JFileChooser changed
// directories. This has not been reproduced or confirmed yet, but is
// pretty scary, and this function isn't too necessary.
//_sysTrayMenu.addItem(_itemSelectBrowser);
_sysTrayMenu.addItem(_itemOpenConsole); _sysTrayMenu.addItem(_itemOpenConsole);
refreshDisplay(); refreshDisplay();
} }

View File

@ -1,4 +1,16 @@
$Id: history.txt,v 1.435 2006/03/18 19:23:23 jrandom Exp $ $Id: history.txt,v 1.436 2006/03/20 00:31:15 jrandom Exp $
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)
2006-03-20 jrandom 2006-03-20 jrandom
* Fix to allow for some slack when coalescing stats * Fix to allow for some slack when coalescing stats

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
* *
*/ */
public class RouterVersion { 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 String VERSION = "0.6.1.12";
public final static long BUILD = 14; public final static long BUILD = 15;
public static void main(String args[]) { public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD); System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID); System.out.println("Router ID: " + RouterVersion.ID);

View File

@ -74,13 +74,14 @@ class FloodfillPeerSelector extends PeerSelector {
return; return;
if (entry.equals(_context.routerHash())) if (entry.equals(_context.routerHash()))
return; return;
if (_context.shitlist().isShitlisted(entry)) // it isn't direct, so who cares if they're shitlisted
return; //if (_context.shitlist().isShitlisted(entry))
// return;
RouterInfo info = _context.netDb().lookupRouterInfoLocally(entry); RouterInfo info = _context.netDb().lookupRouterInfoLocally(entry);
if (info == null) //if (info == null)
return; // return;
if (FloodfillNetworkDatabaseFacade.isFloodfill(info)) { if (info != null && FloodfillNetworkDatabaseFacade.isFloodfill(info)) {
_floodfillMatches.add(entry); _floodfillMatches.add(entry);
} else { } else {
if ( (_wanted > _matches) && (_key != null) ) { if ( (_wanted > _matches) && (_key != null) ) {

View File

@ -133,6 +133,12 @@ class SearchJob extends JobImpl {
public long getExpiration() { return _expiration; } public long getExpiration() { return _expiration; }
public long getTimeoutMs() { return _timeoutMs; } 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; private static final int PER_FLOODFILL_PEER_TIMEOUT = 10*1000;
protected int getPerPeerTimeoutMs(Hash peer) { protected int getPerPeerTimeoutMs(Hash peer) {
@ -245,6 +251,14 @@ class SearchJob extends JobImpl {
int sent = 0; int sent = 0;
Set attempted = _state.getAttempted(); Set attempted = _state.getAttempted();
while (sent <= 0) { 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); List closestHashes = getClosestRouters(_state.getTarget(), toCheck, attempted);
if ( (closestHashes == null) || (closestHashes.size() <= 0) ) { if ( (closestHashes == null) || (closestHashes.size() <= 0) ) {
if (_state.getPending().size() <= 0) { if (_state.getPending().size() <= 0) {
@ -278,10 +292,13 @@ class SearchJob extends JobImpl {
_state.replyTimeout(peer); _state.replyTimeout(peer);
} else { } else {
RouterInfo ri = (RouterInfo)ds; RouterInfo ri = (RouterInfo)ds;
if (!FloodfillNetworkDatabaseFacade.isFloodfill(ri)) if (!FloodfillNetworkDatabaseFacade.isFloodfill(ri)) {
_floodfillPeersExhausted = true; _floodfillPeersExhausted = true;
if (ri.isHidden() || if (onlyFloodfill)
getContext().shitlist().isShitlisted(peer)) { continue;
}
if (ri.isHidden()) {// || // allow querying shitlisted, since its indirect
//getContext().shitlist().isShitlisted(peer)) {
// dont bother // dont bother
} else { } else {
_state.addPending(peer); _state.addPending(peer);

View File

@ -117,6 +117,7 @@ public class OutboundEstablishState {
public void addMessage(OutNetMessage msg) { public void addMessage(OutNetMessage msg) {
synchronized (_queuedMessages) { synchronized (_queuedMessages) {
if (!_queuedMessages.contains(msg))
_queuedMessages.add(msg); _queuedMessages.add(msg);
} }
} }

View File

@ -254,9 +254,9 @@ public class PeerState {
_mtuReceive = _mtu; _mtuReceive = _mtu;
_mtuLastChecked = -1; _mtuLastChecked = -1;
_lastACKSend = -1; _lastACKSend = -1;
_rtt = 1000; _rto = MIN_RTO;
_rtt = _rto/2;
_rttDeviation = _rtt; _rttDeviation = _rtt;
_rto = MAX_RTO;
_messagesReceived = 0; _messagesReceived = 0;
_messagesSent = 0; _messagesSent = 0;
_packetsTransmitted = 0; _packetsTransmitted = 0;
@ -874,7 +874,7 @@ public class PeerState {
double retransPct = 0; double retransPct = 0;
if (_packetsTransmitted > 10) { if (_packetsTransmitted > 10) {
retransPct = (double)_packetsRetransmitted/(double)_packetsTransmitted; 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 (wantLarge && _mtu != LARGE_MTU) {
if (_context.random().nextLong(_mtuDecreases) <= 0) { if (_context.random().nextLong(_mtuDecreases) <= 0) {
_mtu = LARGE_MTU; _mtu = LARGE_MTU;
@ -943,11 +943,13 @@ public class PeerState {
else else
_consecutiveSmall = 0; _consecutiveSmall = 0;
if ( (_consecutiveSmall < 50) && (_packetsReceived > 50) ) if (_packetsReceived > 50) {
if (_consecutiveSmall < 50)
_mtuReceive = LARGE_MTU; _mtuReceive = LARGE_MTU;
else else
_mtuReceive = MIN_MTU; _mtuReceive = MIN_MTU;
} }
}
/** /**
* we received a backoff request, so cut our send window * we received a backoff request, so cut our send window