dont start thread in constructor

This commit is contained in:
zzz
2013-06-28 12:40:09 +00:00
parent 726eb58724
commit 552f91b6b8
2 changed files with 8 additions and 4 deletions

View File

@@ -287,6 +287,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
_context.statManager().createRateStat("i2ptunnel.httpExpanded", "size transferred after expansion", "I2PTunnel", new long[] { 60*60*1000 });
super.startRunning();
this.isr = new InternalSocketRunner(this);
this.isr.start();
_context.portMapper().register(PortMapper.SVC_HTTP_PROXY, getLocalPort());
}

View File

@@ -14,20 +14,23 @@ import net.i2p.util.Log;
* @author zzz
* @since 0.7.9
*/
class InternalSocketRunner implements Runnable {
class InternalSocketRunner extends I2PAppThread {
private final I2PTunnelClientBase client;
private final int port;
private ServerSocket ss;
private volatile boolean open;
/** starts the runner */
/**
* Does not start the runner, caller must call start()
*/
InternalSocketRunner(I2PTunnelClientBase client) {
super("Internal socket port " + client.getLocalPort());
setDaemon(true);
this.client = client;
this.port = client.getLocalPort();
Thread t = new I2PAppThread(this, "Internal socket port " + this.port, true);
t.start();
}
@Override
public final void run() {
try {
this.ss = new InternalServerSocket(this.port);