diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/TunnelController.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/TunnelController.java index 9ab848f5b..230e342e9 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/TunnelController.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/TunnelController.java @@ -16,6 +16,7 @@ import net.i2p.client.I2PClient; import net.i2p.client.I2PClientFactory; import net.i2p.client.I2PSession; import net.i2p.data.Destination; +import net.i2p.util.I2PThread; import net.i2p.util.Log; /** @@ -99,6 +100,11 @@ public class TunnelController implements Logging { } } + public void startTunnelBackground() { + if (_running) return; + new I2PThread(new Runnable() { public void run() { startTunnel(); } }).start(); + } + /** * Start up the tunnel (if it isn't already running) * diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/WebEditPageHelper.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/WebEditPageHelper.java index 44463145e..33711ad72 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/WebEditPageHelper.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/WebEditPageHelper.java @@ -257,6 +257,8 @@ public class WebEditPageHelper { // creating new cur = new TunnelController(config, "", _privKeyGenerate); TunnelControllerGroup.getInstance().addController(cur); + if (cur.getStartOnLoad()) + cur.startTunnelBackground(); } else { cur.setConfig(config, ""); } diff --git a/history.txt b/history.txt index 157ca6e8a..2b1f009b1 100644 --- a/history.txt +++ b/history.txt @@ -1,4 +1,9 @@ -$Id: history.txt,v 1.121 2004/12/29 17:16:42 jrandom Exp $ +$Id: history.txt,v 1.122 2004/12/30 17:51:16 jrandom Exp $ + +2004-12-31 jrandom + * Speling fxi (thanks digum!) + * Bugfix for the I2PTunnel web interface so that it now properly launches + newly added tunnels that are defined to be run on startup (thanks ugha!) 2004-12-30 jrandom * Revised the I2PTunnel client and httpclient connection establishment diff --git a/readme.html b/readme.html index 4779c856f..499892edb 100644 --- a/readme.html +++ b/readme.html @@ -54,7 +54,7 @@ IRC (be sure to split it into two lines, as its too long for one).

If the left hand side has a warning, telling you to check your NAT or firewall, please see the config page and make sure that you can receive inbound -TCP connections on port 8887 (or another port that you specify). Probelms forwarding +TCP connections on port 8887 (or another port that you specify). Problems forwarding that port account for the vast majority of issues people run into. When it says "Active: 72/85", the "72" means how many peers you are connected with now, and "85" means how many you have spoken with recently - if that first number is 0, you can bet that there diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 17a3bb461..557e47a65 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -15,9 +15,9 @@ import net.i2p.CoreVersion; * */ public class RouterVersion { - public final static String ID = "$Revision: 1.126 $ $Date: 2004/12/29 17:16:42 $"; + public final static String ID = "$Revision: 1.127 $ $Date: 2004/12/30 17:51:16 $"; public final static String VERSION = "0.4.2.5"; - public final static long BUILD = 4; + public final static long BUILD = 5; public static void main(String args[]) { System.out.println("I2P Router version: " + VERSION); System.out.println("Router ID: " + RouterVersion.ID); diff --git a/router/java/src/net/i2p/router/transport/tcp/ConnectionRunner.java b/router/java/src/net/i2p/router/transport/tcp/ConnectionRunner.java index f4809fb7b..50d13491a 100644 --- a/router/java/src/net/i2p/router/transport/tcp/ConnectionRunner.java +++ b/router/java/src/net/i2p/router/transport/tcp/ConnectionRunner.java @@ -27,7 +27,8 @@ class ConnectionRunner implements Runnable { private boolean _keepRunning; private byte _writeBuffer[]; private long _lastTimeSend; - private long _lastWrite; + private long _lastWriteEnd; + private long _lastWriteBegin; private static final long TIME_SEND_FREQUENCY = 60*1000; @@ -36,7 +37,8 @@ class ConnectionRunner implements Runnable { _log = ctx.logManager().getLog(ConnectionRunner.class); _con = con; _keepRunning = false; - _lastWrite = ctx.clock().now(); + _lastWriteBegin = ctx.clock().now(); + _lastWriteEnd = _lastWriteBegin; } public void startRunning() { @@ -106,23 +108,21 @@ class ConnectionRunner implements Runnable { OutputStream out = _con.getOutputStream(); boolean ok = false; - long before = -1; - long after = -1; try { synchronized (out) { - before = _context.clock().now(); + _lastWriteBegin = _context.clock().now(); out.write(buf, 0, written); if (sendTime) { out.write(buildTimeMessage().toByteArray()); _lastTimeSend = _context.clock().now(); } out.flush(); - after = _context.clock().now(); + _lastWriteEnd = _context.clock().now(); } if (_log.shouldLog(Log.DEBUG)) _log.debug("Just sent message " + msg.getMessageId() + " to " + msg.getTarget().getIdentity().getHash().toBase64().substring(0,6) - + " writeTime = " + (after-before) +"ms" + + " writeTime = " + (_lastWriteEnd - _lastWriteBegin) +"ms" + " lifetime = " + msg.getLifetime() + "ms"); ok = true; @@ -131,8 +131,7 @@ class ConnectionRunner implements Runnable { _log.warn("Error writing out the message", ioe); _con.closeConnection(); } - _con.sent(msg, ok, after - before); - _lastWrite = after; + _con.sent(msg, ok, _lastWriteEnd - _lastWriteBegin); } /** @@ -160,7 +159,9 @@ class ConnectionRunner implements Runnable { public void timeReached() { if (!_keepRunning) return; if (_con.getIsClosed()) return; - long timeSinceWrite = _context.clock().now() - _lastWrite; + long now = _context.clock().now(); + long timeSinceWrite = now - _lastWriteEnd; + long timeSinceWriteBegin = now - _lastWriteBegin; if (timeSinceWrite > 5*TIME_SEND_FREQUENCY) { TCPTransport t = _con.getTransport(); String msg = "Connection closed with " @@ -168,6 +169,9 @@ class ConnectionRunner implements Runnable { + " due to " + DataHelper.formatDuration(timeSinceWrite) + " of inactivity after " + DataHelper.formatDuration(_con.getLifetime()); + if (_lastWriteBegin > _lastWriteEnd) + msg = msg + " with a message being written for " + + DataHelper.formatDuration(timeSinceWriteBegin); t.addConnectionErrorMessage(msg); if (_log.shouldLog(Log.INFO)) _log.info(msg);