forked from I2P_Developers/i2p.i2p
Remove all the startRunning() calls in constructors,
which duplicated the new ones in I2PTunnel, causing all sorts of trouble. May still need more locking. TBD.
This commit is contained in:
@@ -32,6 +32,9 @@ public class I2PTunnelClient extends I2PTunnelClientBase {
|
||||
protected long readTimeout = DEFAULT_READ_TIMEOUT;
|
||||
|
||||
/**
|
||||
* As of 0.9.20 this is fast, and does NOT connect the manager to the router,
|
||||
* or open the local socket. You MUST call startRunning() for that.
|
||||
*
|
||||
* @param destinations peers we target, comma- or space-separated. Since 0.9.9, each dest may be appended with :port
|
||||
* @throws IllegalArgumentException if the I2PTunnel does not contain
|
||||
* valid config to contact the router
|
||||
@@ -63,9 +66,6 @@ public class I2PTunnelClient extends I2PTunnelClientBase {
|
||||
}
|
||||
|
||||
setName(getLocalPort() + " -> " + destinations);
|
||||
|
||||
startRunning();
|
||||
|
||||
notifyEvent("openClientResult", "ok");
|
||||
}
|
||||
|
||||
|
@@ -398,7 +398,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
||||
if (log != null)
|
||||
log.log("Error opening key file " + ioe);
|
||||
_log.error("Error opening key file", ioe);
|
||||
throw new IllegalArgumentException("Error opening key file " + ioe);
|
||||
throw new IllegalArgumentException("Error opening key file", ioe);
|
||||
} finally {
|
||||
if (fis != null)
|
||||
try { fis.close(); } catch (IOException ioe) {}
|
||||
@@ -500,6 +500,8 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
||||
}
|
||||
|
||||
private void startup() {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("startup " + _clientId, new Exception("I did it"));
|
||||
// prevent JVM exit when running outside the router
|
||||
boolean isDaemon = getTunnel().getContext().isRouterContext();
|
||||
Thread t = new I2PAppThread(this, "Client " + _clientId, isDaemon);
|
||||
|
@@ -77,6 +77,9 @@ public class I2PTunnelConnectClient extends I2PTunnelHTTPClientBase implements R
|
||||
"Your browser is misconfigured. Do not use the proxy to access the router console or other localhost destinations.<BR>";
|
||||
|
||||
/**
|
||||
* As of 0.9.20 this is fast, and does NOT connect the manager to the router,
|
||||
* or open the local socket. You MUST call startRunning() for that.
|
||||
*
|
||||
* @throws IllegalArgumentException if the I2PTunnel does not contain
|
||||
* valid config to contact the router
|
||||
*/
|
||||
@@ -92,8 +95,6 @@ public class I2PTunnelConnectClient extends I2PTunnelHTTPClientBase implements R
|
||||
}
|
||||
|
||||
setName("HTTPS Proxy on " + tunnel.listenHost + ':' + localPort);
|
||||
|
||||
startRunning();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -30,6 +30,9 @@ public class I2PTunnelHTTPBidirProxy extends I2PTunnelHTTPClient implements Runn
|
||||
|
||||
|
||||
/**
|
||||
* As of 0.9.20 this is fast, and does NOT connect the manager to the router,
|
||||
* or open the local socket. You MUST call startRunning() for that.
|
||||
*
|
||||
* @throws IllegalArgumentException if the I2PTunnel does not contain
|
||||
* valid config to contact the router
|
||||
*/
|
||||
@@ -38,8 +41,6 @@ public class I2PTunnelHTTPBidirProxy extends I2PTunnelHTTPClient implements Runn
|
||||
// proxyList = new ArrayList();
|
||||
|
||||
setName(getLocalPort() + " -> HTTPClient [NO PROXIES]");
|
||||
startRunning();
|
||||
|
||||
notifyEvent("openHTTPClientResult", "ok");
|
||||
}
|
||||
}
|
||||
|
@@ -32,7 +32,9 @@ public class I2PTunnelHTTPBidirServer extends I2PTunnelHTTPServer {
|
||||
bidir = true;
|
||||
|
||||
/* start the httpclient */
|
||||
task = new I2PTunnelHTTPBidirProxy(localPort, l, sockMgr, getTunnel(), getEventDispatcher(), __serverId);
|
||||
I2PTunnelClientBase client = new I2PTunnelHTTPBidirProxy(localPort, l, sockMgr, getTunnel(), getEventDispatcher(), __serverId);
|
||||
client.startRunning();
|
||||
task = client;
|
||||
sockMgr.setName("Server"); // TO-DO: Need to change this to "Bidir"!
|
||||
getTunnel().addSession(sockMgr.getSession());
|
||||
l.log("Ready!");
|
||||
|
@@ -192,6 +192,9 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
* This constructor always starts the tunnel (ignoring the i2cp.delayOpen option).
|
||||
* It is used to add a client to an existing socket manager.
|
||||
*
|
||||
* As of 0.9.20 this is fast, and does NOT connect the manager to the router,
|
||||
* or open the local socket. You MUST call startRunning() for that.
|
||||
*
|
||||
* @param sockMgr the existing socket manager
|
||||
*/
|
||||
public I2PTunnelHTTPClient(int localPort, Logging l, I2PSocketManager sockMgr, I2PTunnel tunnel, EventDispatcher notifyThis, long clientId) {
|
||||
@@ -200,12 +203,13 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
// proxyList = new ArrayList();
|
||||
|
||||
setName("HTTP Proxy on " + getTunnel().listenHost + ':' + localPort);
|
||||
startRunning();
|
||||
|
||||
notifyEvent("openHTTPClientResult", "ok");
|
||||
}
|
||||
|
||||
/**
|
||||
* As of 0.9.20 this is fast, and does NOT connect the manager to the router,
|
||||
* or open the local socket. You MUST call startRunning() for that.
|
||||
*
|
||||
* @throws IllegalArgumentException if the I2PTunnel does not contain
|
||||
* valid config to contact the router
|
||||
*/
|
||||
@@ -225,9 +229,6 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
}
|
||||
|
||||
setName("HTTP Proxy on " + tunnel.listenHost + ':' + localPort);
|
||||
|
||||
startRunning();
|
||||
|
||||
notifyEvent("openHTTPClientResult", "ok");
|
||||
}
|
||||
|
||||
@@ -607,6 +608,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
_("i2paddresshelper cannot help you with a destination like that!") +
|
||||
"</p>").getBytes("UTF-8"));
|
||||
writeFooter(out);
|
||||
reader.drain();
|
||||
// XXX: should closeSocket(s) be in a finally block?
|
||||
} catch (IOException ioe) {
|
||||
// ignore
|
||||
@@ -721,7 +723,6 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
out.write(getErrorPage("localhost", ERR_LOCALHOST).getBytes("UTF-8"));
|
||||
writeFooter(out);
|
||||
reader.drain();
|
||||
s.close();
|
||||
} catch (IOException ioe) {
|
||||
// ignore
|
||||
} finally {
|
||||
|
@@ -41,6 +41,9 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase {
|
||||
public static final String PROP_DCC = "i2ptunnel.ircclient.enableDCC";
|
||||
|
||||
/**
|
||||
* As of 0.9.20 this is fast, and does NOT connect the manager to the router,
|
||||
* or open the local socket. You MUST call startRunning() for that.
|
||||
*
|
||||
* @param destinations peers we target, comma- or space-separated. Since 0.9.9, each dest may be appended with :port
|
||||
* @throws IllegalArgumentException if the I2PTunnel does not contain
|
||||
* valid config to contact the router
|
||||
@@ -81,8 +84,6 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase {
|
||||
_dccEnabled = Boolean.parseBoolean(tunnel.getClientOptions().getProperty(PROP_DCC));
|
||||
// TODO add some prudent tunnel options (or is it too late?)
|
||||
|
||||
startRunning();
|
||||
|
||||
notifyEvent("openIRCClientResult", "ok");
|
||||
}
|
||||
|
||||
|
@@ -109,6 +109,7 @@ public class DCCClientManager extends EventReceiver {
|
||||
I2PTunnelDCCClient cTunnel = new I2PTunnelDCCClient(b32, localPort, port, l, sockMgr,
|
||||
_dispatch, _tunnel, ++_id);
|
||||
cTunnel.attachEventDispatcher(this);
|
||||
cTunnel.startRunning();
|
||||
int lport = cTunnel.getLocalPort();
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Opened client tunnel at port " + lport +
|
||||
|
@@ -37,6 +37,9 @@ public class I2PTunnelDCCClient extends I2PTunnelClientBase {
|
||||
public static final String CONNECT_STOP_EVENT = "connectionStopped";
|
||||
|
||||
/**
|
||||
* As of 0.9.20 this is fast, and does NOT connect the manager to the router,
|
||||
* or open the local socket. You MUST call startRunning() for that.
|
||||
*
|
||||
* @param dest the target, presumably b32
|
||||
* @param localPort if 0, use any port, get actual port selected with getLocalPort()
|
||||
* @throws IllegalArgumentException if the I2PTunnel does not contain
|
||||
@@ -51,8 +54,6 @@ public class I2PTunnelDCCClient extends I2PTunnelClientBase {
|
||||
_expires = tunnel.getContext().clock().now() + INBOUND_EXPIRE;
|
||||
|
||||
setName("DCC send -> " + dest + ':' + remotePort);
|
||||
|
||||
startRunning();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -33,7 +33,12 @@ public class I2PSOCKSTunnel extends I2PTunnelClientBase {
|
||||
// I2PSOCKSTunnel(localPort, l, ownDest, (EventDispatcher)null);
|
||||
//}
|
||||
|
||||
/** @param pkf private key file name or null for transient key */
|
||||
/**
|
||||
* As of 0.9.20 this is fast, and does NOT connect the manager to the router,
|
||||
* or open the local socket. You MUST call startRunning() for that.
|
||||
*
|
||||
* @param pkf private key file name or null for transient key
|
||||
*/
|
||||
public I2PSOCKSTunnel(int localPort, Logging l, boolean ownDest, EventDispatcher notifyThis, I2PTunnel tunnel, String pkf) {
|
||||
super(localPort, ownDest, l, notifyThis, "SOCKS Proxy on " + tunnel.listenHost + ':' + localPort, tunnel, pkf);
|
||||
|
||||
@@ -44,8 +49,6 @@ public class I2PSOCKSTunnel extends I2PTunnelClientBase {
|
||||
|
||||
setName("SOCKS Proxy on " + tunnel.listenHost + ':' + localPort);
|
||||
parseOptions();
|
||||
startRunning();
|
||||
|
||||
notifyEvent("openSOCKSTunnelResult", "ok");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user