2006-02-25 jrandom

* Made the Syndie permalinks in the thread view point to the blog view
    * Disabled TCP again (since the live net seems to be doing well w/out it)
    * Fix the message time on inbound SSU establishment (thanks zzz!)
    * Don't be so aggressive with parallel tunnel creation when a tunnel pool
      just starts up
This commit is contained in:
jrandom
2006-02-25 20:41:51 +00:00
committed by zzz
parent 7b2a435aad
commit 62b7cf64da
10 changed files with 95 additions and 44 deletions

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.359 $ $Date: 2006/02/23 09:38:40 $";
public final static String ID = "$Revision: 1.360 $ $Date: 2006/02/24 04:35:52 $";
public final static String VERSION = "0.6.1.11";
public final static long BUILD = 4;
public final static long BUILD = 5;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);

View File

@ -56,7 +56,7 @@ public class TransportManager implements TransportEventListener {
transport.setListener(null);
}
static final boolean ALLOW_TCP = true;
static final boolean ALLOW_TCP = false;
private void configTransports() {
String disableTCP = _context.router().getConfigSetting(PROP_DISABLE_TCP);

View File

@ -456,7 +456,7 @@ public class EstablishmentManager {
_log.info("Completing to the peer after confirm: " + peer);
DeliveryStatusMessage dsm = new DeliveryStatusMessage(_context);
dsm.setArrival(Router.NETWORK_ID); // overloaded, sure, but future versions can check this
dsm.setMessageExpiration(dsm.getArrival()+10*1000);
dsm.setMessageExpiration(_context.clock().now()+10*1000);
dsm.setMessageId(_context.random().nextLong(I2NPMessage.MAX_ID_VALUE));
_transport.send(dsm, peer);
}

View File

@ -212,7 +212,7 @@ public class PeerState {
private static final int LARGE_MTU = 1350;
private static final int MIN_RTO = 100 + ACKSender.ACK_FREQUENCY;
private static final int MAX_RTO = 2000; // 5000;
private static final int MAX_RTO = 3000; // 5000;
/** override the default MTU */
private static final String PROP_DEFAULT_MTU = "i2np.udp.mtu";

View File

@ -101,6 +101,7 @@ public class UDPPacket {
_isInbound = inbound;
_initializeTime = _context.clock().now();
_markedType = -1;
_validateCount = 0;
_remoteHost = null;
_released = false;
}

View File

@ -162,7 +162,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
_context.statManager().createRateStat("udp.addressTestInsteadOfUpdate", "How many times we fire off a peer test of ourselves instead of adjusting our own reachable address?", "udp", new long[] { 1*60*1000, 20*60*1000, 60*60*1000, 24*60*60*1000 });
_context.statManager().createRateStat("udp.addressUpdated", "How many times we adjust our own reachable IP address", "udp", new long[] { 1*60*1000, 20*60*1000, 60*60*1000, 24*60*60*1000 });
_context.statManager().createRateStat("udp.proactiveReestablish", "How long a session was idle for when we proactively reestablished it", "udp", new long[] { 1*60*1000, 20*60*1000, 60*60*1000, 24*60*60*1000 });
_context.statManager().createRateStat("udp.dropPeerDroplist", "How many peers currently have their packets dropped outright when a new peer is added to the list?", "udp", new long[] { 1*60*1000, 20*60*1000 });
__instance = this;
}
@ -584,6 +584,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
if (peer != null) {
RemoteHostId remote = peer.getRemoteHostId();
boolean added = false;
int droplistSize = 0;
synchronized (_dropList) {
if (!_dropList.contains(remote)) {
while (_dropList.size() > MAX_DROPLIST_SIZE)
@ -591,8 +592,12 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
_dropList.add(remote);
added = true;
}
droplistSize = _dropList.size();
}
if (added) {
_context.statManager().addRateData("udp.dropPeerDroplist", droplistSize, 0);
SimpleTimer.getInstance().addEvent(new RemoveDropList(remote), DROPLIST_PERIOD);
}
if (added) SimpleTimer.getInstance().addEvent(new RemoveDropList(remote), DROPLIST_PERIOD);
}
_context.shitlist().shitlistRouter(peerHash, "Part of the wrong network");
dropPeer(peerHash);

View File

@ -33,6 +33,7 @@ public class TunnelPool {
private TunnelInfo _lastSelected;
private long _lastSelectionPeriod;
private int _expireSkew;
private long _started;
public TunnelPool(RouterContext ctx, TunnelPoolManager mgr, TunnelPoolSettings settings, TunnelPeerSelector sel) {
_context = ctx;
@ -46,11 +47,13 @@ public class TunnelPool {
_lastSelected = null;
_lifetimeProcessed = 0;
_expireSkew = _context.random().nextInt(90*1000);
_started = System.currentTimeMillis();
refreshSettings();
}
public void startup() {
_alive = true;
_started = System.currentTimeMillis();
_manager.getExecutor().repoll();
if (_settings.isInbound() && (_settings.getDestination() != null) ) {
// we just reconnected and didn't require any new tunnel builders.
@ -101,6 +104,8 @@ public class TunnelPool {
return period;
}
private long getLifetime() { return System.currentTimeMillis() - _started; }
/**
* Pull a random tunnel out of the pool. If there are none available but
* the pool is configured to allow 0hop tunnels, this builds a fake one
@ -555,12 +560,16 @@ public class TunnelPool {
if (rv + inProgress + expireLater + fallback > 4*standardAmount)
rv = 4*standardAmount - inProgress - expireLater - fallback;
long lifetime = getLifetime();
if ( (lifetime < 60*1000) && (rv + inProgress + fallback >= standardAmount) )
rv = standardAmount - inProgress - fallback;
if (_log.shouldLog(Log.DEBUG))
_log.debug("Count: rv: " + rv + " allow? " + allowZeroHop
+ " 30s " + expire30s + " 90s " + expire90s + " 150s " + expire150s + " 210s " + expire210s
+ " 270s " + expire270s + " later " + expireLater
+ " std " + standardAmount + " inProgress " + inProgress + " fallback " + fallback
+ " for " + toString());
+ " for " + toString() + " up for " + lifetime);
if (rv < 0)
return 0;