From 56ecdcce82960f3f058c9bd7e6d3121b22e66545 Mon Sep 17 00:00:00 2001 From: jrandom Date: Sun, 25 Sep 2005 23:52:58 +0000 Subject: [PATCH] 2005-09-25 jrandom * Allow reseeding on the console if the netDb knows less than 30 peers, rather than less than 10 (without internet connectivity, we keep the last 15 router references) * Reenable the x-i2p-gzip HTTP processing by default, flushing the stream more aggressively. * Show the status that used to be called "ERR-Reject" as "OK (NAT)" * Reduced the default maximum number of streaming lib resends of a packet (10 retransmits is a bit much with a reasonable RTO) --- .../net/i2p/i2ptunnel/HTTPResponseOutputStream.java | 10 ++++++---- .../src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java | 4 +++- .../src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java | 2 +- .../java/src/net/i2p/router/web/SummaryHelper.java | 4 ++-- .../net/i2p/client/streaming/ConnectionOptions.java | 4 ++-- history.txt | 12 +++++++++++- router/java/src/net/i2p/router/RouterVersion.java | 4 ++-- 7 files changed, 27 insertions(+), 13 deletions(-) diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/HTTPResponseOutputStream.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/HTTPResponseOutputStream.java index ef248baed..9400efd3e 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/HTTPResponseOutputStream.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/HTTPResponseOutputStream.java @@ -65,6 +65,7 @@ class HTTPResponseOutputStream extends FilterOutputStream { if (_headerWritten) { out.write(buf, off, len); _dataWritten += len; + out.flush(); return; } @@ -80,6 +81,7 @@ class HTTPResponseOutputStream extends FilterOutputStream { // write out the remaining out.write(buf, off+i+1, len-i-1); _dataWritten += len-i-1; + out.flush(); } return; } @@ -236,15 +238,15 @@ class HTTPResponseOutputStream extends FilterOutputStream { if (_out != null) try { _out.close(); } catch (IOException ioe) {} } long end = System.currentTimeMillis(); - long compressed = in.getTotalRead(); - long expanded = in.getTotalExpanded(); + double compressed = in.getTotalRead(); + double expanded = in.getTotalExpanded(); double ratio = 0; if (expanded > 0) ratio = compressed/expanded; _context.statManager().addRateData("i2ptunnel.httpCompressionRatio", (int)(100d*ratio), end-start); - _context.statManager().addRateData("i2ptunnel.httpCompressed", compressed, end-start); - _context.statManager().addRateData("i2ptunnel.httpExpanded", expanded, end-start); + _context.statManager().addRateData("i2ptunnel.httpCompressed", (long)compressed, end-start); + _context.statManager().addRateData("i2ptunnel.httpExpanded", (long)expanded, end-start); } } private class InternalGZIPInputStream extends GZIPInputStream { diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java index acfdfc4ad..caefe8db9 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java @@ -195,6 +195,8 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable return opts; } + private static final boolean DEFAULT_GZIP = true; + private static long __requestId = 0; protected void clientConnectionRun(Socket s) { OutputStream out = null; @@ -439,7 +441,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable if (line.length() == 0) { String ok = getTunnel().getContext().getProperty("i2ptunnel.gzip"); - boolean gzip = false; + boolean gzip = DEFAULT_GZIP; if (ok != null) gzip = Boolean.valueOf(ok).booleanValue(); if (gzip) diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java index ca1a1cf40..b7363fcda 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java @@ -178,7 +178,7 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer { if (_log.shouldLog(Log.INFO)) _log.info(_name + ": Begin sending"); try { - byte buf[] = new byte[4096]; + byte buf[] = new byte[16*1024]; int read = 0; int total = 0; while ( (read = _in.read(buf)) != -1) { diff --git a/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java index 621f80496..d02b29914 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java @@ -95,7 +95,7 @@ public class SummaryHelper { } public boolean allowReseed() { - return (_context.netDb().getKnownRouters() < 10); + return (_context.netDb().getKnownRouters() < 30); } public int getAllPeers() { return _context.netDb().getKnownRouters(); } @@ -108,7 +108,7 @@ public class SummaryHelper { case CommSystemFacade.STATUS_DIFFERENT: return "ERR-SymmetricNAT"; case CommSystemFacade.STATUS_REJECT_UNSOLICITED: - return "ERR-Reject"; + return "OK (NAT)"; case CommSystemFacade.STATUS_UNKNOWN: // fallthrough default: return "Unknown"; 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 0bddc6084..0a2f93b89 100644 --- a/apps/streaming/java/src/net/i2p/client/streaming/ConnectionOptions.java +++ b/apps/streaming/java/src/net/i2p/client/streaming/ConnectionOptions.java @@ -102,7 +102,7 @@ public class ConnectionOptions extends I2PSocketOptionsImpl { setResendDelay(getInt(opts, PROP_INITIAL_RESEND_DELAY, 1000)); setSendAckDelay(getInt(opts, PROP_INITIAL_ACK_DELAY, 500)); setWindowSize(getInt(opts, PROP_INITIAL_WINDOW_SIZE, INITIAL_WINDOW_SIZE)); - setMaxResends(getInt(opts, PROP_MAX_RESENDS, 10)); + setMaxResends(getInt(opts, PROP_MAX_RESENDS, 5)); 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)); @@ -135,7 +135,7 @@ public class ConnectionOptions extends I2PSocketOptionsImpl { if (opts.containsKey(PROP_INITIAL_WINDOW_SIZE)) setWindowSize(getInt(opts, PROP_INITIAL_WINDOW_SIZE, INITIAL_WINDOW_SIZE)); if (opts.containsKey(PROP_MAX_RESENDS)) - setMaxResends(getInt(opts, PROP_MAX_RESENDS, 10)); + setMaxResends(getInt(opts, PROP_MAX_RESENDS, 5)); if (opts.containsKey(PROP_WRITE_TIMEOUT)) setWriteTimeout(getInt(opts, PROP_WRITE_TIMEOUT, -1)); if (opts.containsKey(PROP_INACTIVITY_TIMEOUT)) diff --git a/history.txt b/history.txt index 4d19759f8..3f1a04119 100644 --- a/history.txt +++ b/history.txt @@ -1,4 +1,14 @@ -$Id: history.txt,v 1.263 2005/09/21 18:01:37 jrandom Exp $ +$Id: history.txt,v 1.264 2005/09/25 04:29:01 jrandom Exp $ + +2005-09-25 jrandom + * Allow reseeding on the console if the netDb knows less than 30 peers, + rather than less than 10 (without internet connectivity, we keep the + last 15 router references) + * Reenable the x-i2p-gzip HTTP processing by default, flushing the stream + more aggressively. + * Show the status that used to be called "ERR-Reject" as "OK (NAT)" + * Reduced the default maximum number of streaming lib resends of a packet + (10 retransmits is a bit much with a reasonable RTO) 2005-09-25 Complication * Better i2paddresshelper handling in the I2PTunnel httpclient, plus a new diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index f72cdd240..f8e230f72 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.243 $ $Date: 2005/09/21 01:43:04 $"; + public final static String ID = "$Revision: 1.244 $ $Date: 2005/09/25 04:29:02 $"; public final static String VERSION = "0.6.0.6"; - public final static long BUILD = 3; + public final static long BUILD = 4; public static void main(String args[]) { System.out.println("I2P Router version: " + VERSION + "-" + BUILD); System.out.println("Router ID: " + RouterVersion.ID);