From 1aba32448161049480263853493d9acb0cf52e65 Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Fri, 15 Oct 2010 13:41:56 +0000 Subject: [PATCH] * I2PSocketEepGet: Set connect delay to save a RTT, will speed announces in i2psnark --- .../src/net/i2p/client/streaming/I2PSocketEepGet.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketEepGet.java b/apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketEepGet.java index 8aac29cffa..834c52160c 100644 --- a/apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketEepGet.java +++ b/apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketEepGet.java @@ -45,6 +45,10 @@ public class I2PSocketEepGet extends EepGet { /** this replaces _proxy in the superclass. Sadly, I2PSocket does not extend Socket. */ private I2PSocket _socket; + /** from ConnectionOptions */ + private static final String PROP_CONNECT_DELAY = "i2p.streaming.connectDelay"; + private static final String CONNECT_DELAY = "500"; + public I2PSocketEepGet(I2PAppContext ctx, I2PSocketManager mgr, int numRetries, String outputFile, String url) { this(ctx, mgr, numRetries, -1, -1, outputFile, null, url); } @@ -123,6 +127,10 @@ public class I2PSocketEepGet extends EepGet { Properties props = new Properties(); props.setProperty(I2PSocketOptions.PROP_CONNECT_TIMEOUT, "" + CONNECT_TIMEOUT); props.setProperty(I2PSocketOptions.PROP_READ_TIMEOUT, "" + INACTIVITY_TIMEOUT); + // This is important - even if the underlying socket doesn't have a connect delay, + // we want to set it for this connection, so the request headers will go out + // in the SYN packet, saving one RTT. + props.setProperty(PROP_CONNECT_DELAY, CONNECT_DELAY); I2PSocketOptions opts = _socketManager.buildOptions(props); _socket = _socketManager.connect(dest, opts); } else { -- GitLab