From 2590e7d4ff57f1beb0a42c087da1367ca4684ce7 Mon Sep 17 00:00:00 2001 From: str4d Date: Thu, 4 Jun 2015 22:25:44 +0000 Subject: [PATCH] i2ptunnel: Don't connect manager to router in constructor (ticket #815) --- .../i2p/i2ptunnel/I2PTunnelClientBase.java | 37 ++++++------------- history.txt | 4 ++ 2 files changed, 16 insertions(+), 25 deletions(-) diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClientBase.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClientBase.java index 2d4d7e0dd..a2508224f 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClientBase.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClientBase.java @@ -119,9 +119,13 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna /** * The main constructor. - * - * As of 0.9.20 this is fast, and does NOT connect the manager to the router, + *

+ * As of 0.9.21 this is fast, and does NOT connect the manager to the router, * or open the local socket. You MUST call startRunning() for that. + *

+ * (0.9.20 claimed to be fast, but due to a bug it DID connect the manager + * to the router. It did NOT open the local socket however, so it was still + * necessary to call startRunning() for that.) * * @param localPort if 0, use any port, get actual port selected with getLocalPort() * @throws IllegalArgumentException if the I2CP configuration is b0rked so @@ -135,9 +139,13 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna /** * Use this to build a client with a persistent private key. - * - * As of 0.9.20 this is fast, and does NOT connect the manager to the router, + *

+ * As of 0.9.21 this is fast, and does NOT connect the manager to the router, * or open the local socket. You MUST call startRunning() for that. + *

+ * (0.9.20 claimed to be fast, but due to a bug it DID connect the manager + * to the router. It did NOT open the local socket however, so it was still + * necessary to call startRunning() for that.) * * @param localPort if 0, use any port, get actual port selected with getLocalPort() * @param pkf Path to the private key file, or null to generate a transient key @@ -178,27 +186,6 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna tunnel.getClientOptions().setProperty("i2cp.dontPublishLeaseSet", "true"); if (tunnel.getClientOptions().getProperty("i2p.streaming.answerPings") == null) tunnel.getClientOptions().setProperty("i2p.streaming.answerPings", "false"); - - boolean openNow = !Boolean.parseBoolean(tunnel.getClientOptions().getProperty("i2cp.delayOpen")); - if (openNow) { - while (sockMgr == null) { - verifySocketManager(); - if (sockMgr == null) { - _log.error("Unable to connect to router and build tunnels for " + handlerName); - // FIXME there is a loop in buildSocketManager(), do we really need another one here? - // no matter, buildSocketManager() now throws an IllegalArgumentException - try { Thread.sleep(10*1000); } catch (InterruptedException ie) {} - } - } - // can't be null unless we limit the loop above - //if (sockMgr == null) { - // l.log("Invalid I2CP configuration"); - // throw new IllegalArgumentException("Socket manager could not be created"); - //} - l.log("Tunnels ready for client: " + handlerName); - - } // else delay creating session until createI2PSocket() is called - } /** diff --git a/history.txt b/history.txt index 546905432..3b9056260 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,7 @@ +2015-06-04 str4d + * i2ptunnel: + - Don't connect manager to router in constructor (ticket #815) + 2015-06-03 zzz Prop from i2p.i2p.zzz.sam: * I2CP: Set keepalive on sockets (ticket #1573)