forked from I2P_Developers/i2p.i2p
* SSU:
- Increase default max connections again - Reduce min idle time - Separate out introducer pinger from introducer selection so it can be run separately and more often - Only ping introducers if we need them
This commit is contained in:
@@ -144,11 +144,19 @@ class IntroductionManager {
|
||||
|
||||
// FIXME failsafe if found == 0, relax inactivityCutoff and try again?
|
||||
|
||||
pingIntroducers();
|
||||
return found;
|
||||
}
|
||||
|
||||
/**
|
||||
* Was part of pickInbound(), moved out so we can call it more often
|
||||
* @since 0.8.11
|
||||
*/
|
||||
public void pingIntroducers() {
|
||||
// Try to keep the connection up for two hours after we made anybody an introducer
|
||||
long pingCutoff = _context.clock().now() - (2 * 60 * 60 * 1000);
|
||||
inactivityCutoff = _context.clock().now() - (UDPTransport.EXPIRE_TIMEOUT / 4);
|
||||
for (int i = 0; i < sz; i++) {
|
||||
PeerState cur = peers.get(i);
|
||||
long pingCutoff = _context.clock().now() - (105 * 60 * 1000);
|
||||
long inactivityCutoff = _context.clock().now() - UDPTransport.MIN_EXPIRE_TIMEOUT;
|
||||
for (PeerState cur : _inbound) {
|
||||
if (cur.getIntroducerTime() > pingCutoff &&
|
||||
cur.getLastSendTime() < inactivityCutoff) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
@@ -157,8 +165,6 @@ class IntroductionManager {
|
||||
_transport.send(_builder.buildPing(cur));
|
||||
}
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -227,6 +227,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
_context.statManager().createRateStat("udp.dropPeerDroplist", "How many peers currently have their packets dropped outright when a new peer is added to the list?", "udp", RATES);
|
||||
_context.statManager().createRateStat("udp.dropPeerConsecutiveFailures", "How many consecutive failed sends to a peer did we attempt before giving up and reestablishing a new session (lifetime is inactivity perood)", "udp", RATES);
|
||||
__instance = this;
|
||||
|
||||
SimpleScheduler.getInstance().addPeriodicEvent(new PingIntroducers(), MIN_EXPIRE_TIMEOUT * 3 / 4);
|
||||
}
|
||||
|
||||
public void startup() {
|
||||
@@ -1154,9 +1156,9 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
// and lose the old introducer tags, causing introduction fails,
|
||||
// so we keep the max time long to give the introducer keepalive code
|
||||
// in the IntroductionManager a chance to work.
|
||||
public static final int EXPIRE_TIMEOUT = 30*60*1000;
|
||||
public static final int EXPIRE_TIMEOUT = 20*60*1000;
|
||||
private static final int MAX_IDLE_TIME = EXPIRE_TIMEOUT;
|
||||
private static final int MIN_EXPIRE_TIMEOUT = 10*60*1000;
|
||||
public static final int MIN_EXPIRE_TIMEOUT = 6*60*1000;
|
||||
|
||||
public String getStyle() { return STYLE; }
|
||||
|
||||
@@ -1253,8 +1255,9 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
return getCurrentAddress();
|
||||
}
|
||||
|
||||
void rebuildExternalAddress() { rebuildExternalAddress(true); }
|
||||
void rebuildExternalAddress(boolean allowRebuildRouterInfo) {
|
||||
private void rebuildExternalAddress() { rebuildExternalAddress(true); }
|
||||
|
||||
private void rebuildExternalAddress(boolean allowRebuildRouterInfo) {
|
||||
// if the external port is specified, we want to use that to bind to even
|
||||
// if we don't know the external host.
|
||||
_externalListenPort = _context.getProperty(PROP_EXTERNAL_PORT, -1);
|
||||
@@ -2459,6 +2462,18 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Periodically ping the introducers, split out since we need to
|
||||
* do it faster than we rebuild our address.
|
||||
* @since 0.8.11
|
||||
*/
|
||||
private class PingIntroducers implements SimpleTimer.TimedEvent {
|
||||
public void timeReached() {
|
||||
if (introducersRequired())
|
||||
_introManager.pingIntroducers();
|
||||
}
|
||||
}
|
||||
|
||||
/*******
|
||||
private static final String BADIPS[] = new String[] { "192.168.0.1", "127.0.0.1", "10.3.4.5", "172.16.3.4", "224.5.6.7" };
|
||||
private static final String GOODIPS[] = new String[] { "192.167.0.1", "126.0.0.1", "11.3.4.5", "172.15.3.4", "223.5.6.7" };
|
||||
|
Reference in New Issue
Block a user