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)
This commit is contained in:
jrandom
2005-09-25 23:52:58 +00:00
committed by zzz
parent b9b59ff95f
commit 56ecdcce82
7 changed files with 27 additions and 13 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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