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!)
This commit is contained in:
jrandom
2004-12-31 17:18:05 +00:00
committed by zzz
parent aec0b0c86a
commit 70d6332bad
6 changed files with 31 additions and 14 deletions

View File

@ -16,6 +16,7 @@ import net.i2p.client.I2PClient;
import net.i2p.client.I2PClientFactory; import net.i2p.client.I2PClientFactory;
import net.i2p.client.I2PSession; import net.i2p.client.I2PSession;
import net.i2p.data.Destination; import net.i2p.data.Destination;
import net.i2p.util.I2PThread;
import net.i2p.util.Log; 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) * Start up the tunnel (if it isn't already running)
* *

View File

@ -257,6 +257,8 @@ public class WebEditPageHelper {
// creating new // creating new
cur = new TunnelController(config, "", _privKeyGenerate); cur = new TunnelController(config, "", _privKeyGenerate);
TunnelControllerGroup.getInstance().addController(cur); TunnelControllerGroup.getInstance().addController(cur);
if (cur.getStartOnLoad())
cur.startTunnelBackground();
} else { } else {
cur.setConfig(config, ""); cur.setConfig(config, "");
} }

View File

@ -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 2004-12-30 jrandom
* Revised the I2PTunnel client and httpclient connection establishment * Revised the I2PTunnel client and httpclient connection establishment

View File

@ -54,7 +54,7 @@ IRC (be sure to split it into two lines, as its too long for one).</p>
<p>If the left hand side has a warning, telling you to check your NAT or firewall, please <p>If the left hand side has a warning, telling you to check your NAT or firewall, please
see the <a href="/config.jsp">config page</a> and make sure that you can receive <b>inbound see the <a href="/config.jsp">config page</a> and make sure that you can receive <b>inbound
TCP connections on port 8887</b> (or another port that you specify). Probelms forwarding TCP connections on port 8887</b> (or another port that you specify). Problems forwarding
that port account for the vast majority of issues people run into. When it says 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 "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 how many you have spoken with recently - if that first number is 0, you can bet that there

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
* *
*/ */
public class RouterVersion { 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 String VERSION = "0.4.2.5";
public final static long BUILD = 4; public final static long BUILD = 5;
public static void main(String args[]) { public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION); System.out.println("I2P Router version: " + VERSION);
System.out.println("Router ID: " + RouterVersion.ID); System.out.println("Router ID: " + RouterVersion.ID);

View File

@ -27,7 +27,8 @@ class ConnectionRunner implements Runnable {
private boolean _keepRunning; private boolean _keepRunning;
private byte _writeBuffer[]; private byte _writeBuffer[];
private long _lastTimeSend; private long _lastTimeSend;
private long _lastWrite; private long _lastWriteEnd;
private long _lastWriteBegin;
private static final long TIME_SEND_FREQUENCY = 60*1000; private static final long TIME_SEND_FREQUENCY = 60*1000;
@ -36,7 +37,8 @@ class ConnectionRunner implements Runnable {
_log = ctx.logManager().getLog(ConnectionRunner.class); _log = ctx.logManager().getLog(ConnectionRunner.class);
_con = con; _con = con;
_keepRunning = false; _keepRunning = false;
_lastWrite = ctx.clock().now(); _lastWriteBegin = ctx.clock().now();
_lastWriteEnd = _lastWriteBegin;
} }
public void startRunning() { public void startRunning() {
@ -106,23 +108,21 @@ class ConnectionRunner implements Runnable {
OutputStream out = _con.getOutputStream(); OutputStream out = _con.getOutputStream();
boolean ok = false; boolean ok = false;
long before = -1;
long after = -1;
try { try {
synchronized (out) { synchronized (out) {
before = _context.clock().now(); _lastWriteBegin = _context.clock().now();
out.write(buf, 0, written); out.write(buf, 0, written);
if (sendTime) { if (sendTime) {
out.write(buildTimeMessage().toByteArray()); out.write(buildTimeMessage().toByteArray());
_lastTimeSend = _context.clock().now(); _lastTimeSend = _context.clock().now();
} }
out.flush(); out.flush();
after = _context.clock().now(); _lastWriteEnd = _context.clock().now();
} }
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("Just sent message " + msg.getMessageId() + " to " _log.debug("Just sent message " + msg.getMessageId() + " to "
+ msg.getTarget().getIdentity().getHash().toBase64().substring(0,6) + msg.getTarget().getIdentity().getHash().toBase64().substring(0,6)
+ " writeTime = " + (after-before) +"ms" + " writeTime = " + (_lastWriteEnd - _lastWriteBegin) +"ms"
+ " lifetime = " + msg.getLifetime() + "ms"); + " lifetime = " + msg.getLifetime() + "ms");
ok = true; ok = true;
@ -131,8 +131,7 @@ class ConnectionRunner implements Runnable {
_log.warn("Error writing out the message", ioe); _log.warn("Error writing out the message", ioe);
_con.closeConnection(); _con.closeConnection();
} }
_con.sent(msg, ok, after - before); _con.sent(msg, ok, _lastWriteEnd - _lastWriteBegin);
_lastWrite = after;
} }
/** /**
@ -160,7 +159,9 @@ class ConnectionRunner implements Runnable {
public void timeReached() { public void timeReached() {
if (!_keepRunning) return; if (!_keepRunning) return;
if (_con.getIsClosed()) 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) { if (timeSinceWrite > 5*TIME_SEND_FREQUENCY) {
TCPTransport t = _con.getTransport(); TCPTransport t = _con.getTransport();
String msg = "Connection closed with " String msg = "Connection closed with "
@ -168,6 +169,9 @@ class ConnectionRunner implements Runnable {
+ " due to " + DataHelper.formatDuration(timeSinceWrite) + " due to " + DataHelper.formatDuration(timeSinceWrite)
+ " of inactivity after " + " of inactivity after "
+ DataHelper.formatDuration(_con.getLifetime()); + DataHelper.formatDuration(_con.getLifetime());
if (_lastWriteBegin > _lastWriteEnd)
msg = msg + " with a message being written for " +
DataHelper.formatDuration(timeSinceWriteBegin);
t.addConnectionErrorMessage(msg); t.addConnectionErrorMessage(msg);
if (_log.shouldLog(Log.INFO)) if (_log.shouldLog(Log.INFO))
_log.info(msg); _log.info(msg);