diff --git a/apps/streaming/java/src/net/i2p/client/streaming/Connection.java b/apps/streaming/java/src/net/i2p/client/streaming/Connection.java index 58cf008d67..2d8f263ff1 100644 --- a/apps/streaming/java/src/net/i2p/client/streaming/Connection.java +++ b/apps/streaming/java/src/net/i2p/client/streaming/Connection.java @@ -732,10 +732,12 @@ public class Connection { _log.debug("Resetting the inactivity timer, but its gone!", new Exception("where did it go?")); return; } - long howLong = _activityTimer.getTimeLeft(); + long howLong = _options.getInactivityTimeout(); + howLong += _context.random().nextInt(30*1000); // randomize it a bit, so both sides don't do it at once if (_log.shouldLog(Log.DEBUG)) _log.debug("Resetting the inactivity timer to " + howLong, new Exception("Reset by")); // this will get rescheduled, and rescheduled, and rescheduled... + SimpleTimer.getInstance().removeEvent(_activityTimer); SimpleTimer.getInstance().addEvent(_activityTimer, howLong); } diff --git a/apps/streaming/java/src/net/i2p/client/streaming/ConnectionOptions.java b/apps/streaming/java/src/net/i2p/client/streaming/ConnectionOptions.java index ecbb019019..d830026f53 100644 --- a/apps/streaming/java/src/net/i2p/client/streaming/ConnectionOptions.java +++ b/apps/streaming/java/src/net/i2p/client/streaming/ConnectionOptions.java @@ -105,8 +105,8 @@ public class ConnectionOptions extends I2PSocketOptionsImpl { setWindowSize(getInt(opts, PROP_INITIAL_WINDOW_SIZE, INITIAL_WINDOW_SIZE)); setMaxResends(getInt(opts, PROP_MAX_RESENDS, DEFAULT_MAX_SENDS)); setWriteTimeout(getInt(opts, PROP_WRITE_TIMEOUT, -1)); - setInactivityTimeout(getInt(opts, PROP_INACTIVITY_TIMEOUT, 2*60*1000)); - setInactivityAction(getInt(opts, PROP_INACTIVITY_ACTION, INACTIVITY_ACTION_DISCONNECT)); + setInactivityTimeout(getInt(opts, PROP_INACTIVITY_TIMEOUT, 90*1000)); + setInactivityAction(getInt(opts, PROP_INACTIVITY_ACTION, INACTIVITY_ACTION_SEND)); setInboundBufferSize(getMaxMessageSize() * (Connection.MAX_WINDOW_SIZE + 2)); setCongestionAvoidanceGrowthRateFactor(getInt(opts, PROP_CONGESTION_AVOIDANCE_GROWTH_RATE_FACTOR, 1)); setSlowStartGrowthRateFactor(getInt(opts, PROP_SLOW_START_GROWTH_RATE_FACTOR, 1)); @@ -140,9 +140,9 @@ public class ConnectionOptions extends I2PSocketOptionsImpl { if (opts.containsKey(PROP_WRITE_TIMEOUT)) setWriteTimeout(getInt(opts, PROP_WRITE_TIMEOUT, -1)); if (opts.containsKey(PROP_INACTIVITY_TIMEOUT)) - setInactivityTimeout(getInt(opts, PROP_INACTIVITY_TIMEOUT, 2*60*1000)); + setInactivityTimeout(getInt(opts, PROP_INACTIVITY_TIMEOUT, 90*1000)); if (opts.containsKey(PROP_INACTIVITY_ACTION)) - setInactivityAction(getInt(opts, PROP_INACTIVITY_ACTION, INACTIVITY_ACTION_DISCONNECT)); + setInactivityAction(getInt(opts, PROP_INACTIVITY_ACTION, INACTIVITY_ACTION_SEND)); setInboundBufferSize(getMaxMessageSize() * (Connection.MAX_WINDOW_SIZE + 2)); if (opts.contains(PROP_CONGESTION_AVOIDANCE_GROWTH_RATE_FACTOR)) setCongestionAvoidanceGrowthRateFactor(getInt(opts, PROP_CONGESTION_AVOIDANCE_GROWTH_RATE_FACTOR, 2)); diff --git a/history.txt b/history.txt index ae17bdaa36..32f3995ae3 100644 --- a/history.txt +++ b/history.txt @@ -1,4 +1,12 @@ -$Id: history.txt,v 1.285 2005/10/07 15:19:04 jrandom Exp $ +$Id: history.txt,v 1.286 2005/10/08 17:05:49 jrandom Exp $ + +2005-10-09 jrandom + * Now that the streaming lib works reasonably, set the default inactivity + event to send a 0 byte keepalive payload, rather than disconnecting the + stream. This should cut the irc netsplits and help out with other long + lived streams. The default timeout is now less than the old timeout as + well, so the keepalive will be sent before earlier builds fire their + fatal timeouts. 2005-10-08 jrandom * Use the OS clock for stat timing, since it doesn't jump around (though diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index fa0fb229bc..a5408f020c 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -15,9 +15,9 @@ import net.i2p.CoreVersion; * */ public class RouterVersion { - public final static String ID = "$Revision: 1.260 $ $Date: 2005/10/07 15:19:07 $"; + public final static String ID = "$Revision: 1.261 $ $Date: 2005/10/08 17:05:48 $"; public final static String VERSION = "0.6.1.2"; - public final static long BUILD = 1; + public final static long BUILD = 2; public static void main(String args[]) { System.out.println("I2P Router version: " + VERSION + "-" + BUILD); System.out.println("Router ID: " + RouterVersion.ID);