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" +
",tunnel.acceptLoad.60000" +
",client.sendAckTime.60000" +
",client.dispatchNoACK.60000";
",client.dispatchNoACK.60000" +
",transport.sendMessageFailureLifetime.60000" +
",transport.sendProcessingTime.60000";
private String adjustDatabases(String oldSpecs) {
String spec = _context.getProperty("stat.summaries", DEFAULT_DATABASES);

View File

@ -210,6 +210,11 @@ public class Connection {
}
}
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();
if (evt != null) {
boolean sent = evt.retransmit(false);
@ -240,9 +245,11 @@ public class Connection {
_disconnectScheduledOn = _context.clock().now();
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;
if (_resetSentOn <= 0)
_resetSentOn = _context.clock().now();
_resetSentOn = now;
if ( (_remotePeer == null) || (_sendStreamId <= 0) ) return;
PacketLocal reply = new PacketLocal(_context, _remotePeer);
reply.setFlag(Packet.FLAG_RESET);

View File

@ -169,7 +169,14 @@ public class SysTray implements SysTrayMenuListener {
_itemOpenConsole.addSysTrayMenuListener(this);
// _sysTrayMenu.addItem(_itemShutdown);
// _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);
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
* Fix to allow for some slack when coalescing stats

View File

@ -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);

View File

@ -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) ) {

View File

@ -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);

View File

@ -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() {

View File

@ -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;
}
}
/**