diff --git a/history.txt b/history.txt index 3750d09a7cd8886ef4afb50d4f9eb027db4ec906..627fd739837104f400e4ff15f0d5771e0e928a7f 100644 --- a/history.txt +++ b/history.txt @@ -1,4 +1,12 @@ -$Id: history.txt,v 1.107 2004/12/14 11:42:35 jrandom Exp $ +$Id: history.txt,v 1.108 2004/12/15 21:45:56 jrandom Exp $ + +2004-12-16 jrandom + * Remove the randomized factor in the tunnel rejection by bandwidth - + we now accept the request if we've allocated less than our limit + and reject it if we've allocated more. + * Stick to the standard capacity scale on tunnel rejection, even for + the 10m period. + * Build the time message at the very last possible moment 2004-12-15 jrandom * Handle hard disconnects more gracefully within the streaming lib, and diff --git a/router/java/src/net/i2p/router/RouterThrottleImpl.java b/router/java/src/net/i2p/router/RouterThrottleImpl.java index b6ad5f11b6421a36b64a5124622fbf9ab2a950a7..e52adbbb56c0e553fd87ade2c1ba96a770280421 100644 --- a/router/java/src/net/i2p/router/RouterThrottleImpl.java +++ b/router/java/src/net/i2p/router/RouterThrottleImpl.java @@ -241,7 +241,7 @@ class RouterThrottleImpl implements RouterThrottle { double allocatedKBps = toAllocate / (10 * 60 * 1024); - if (_context.random().nextInt(100) > 100 * pctFull) { + if (pctFull < 1.0) { // (_context.random().nextInt(100) > 100 * pctFull) { if (_log.shouldLog(Log.DEBUG)) _log.debug("Probabalistically allowing the tunnel w/ " + pctFull + " of our " + bytesAllowed + "bytes/" + allocatedKBps + "KBps allocated through " + numTunnels + " tunnels"); diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 914b1a82ac194e0101fa2f913d762b8c586932ec..3fc2dce40bbc1865e55f0ca49044a60303e80ef7 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.112 $ $Date: 2004/12/14 11:42:35 $"; + public final static String ID = "$Revision: 1.113 $ $Date: 2004/12/15 21:45:55 $"; public final static String VERSION = "0.4.2.3"; - public final static long BUILD = 6; + public final static long BUILD = 7; 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/peermanager/CapacityCalculator.java b/router/java/src/net/i2p/router/peermanager/CapacityCalculator.java index 35e36043b937c41232905adc2af9bfbd8de38175..0a8670471abe4c5c4404d548b979bfd0d3e7ff9a 100644 --- a/router/java/src/net/i2p/router/peermanager/CapacityCalculator.java +++ b/router/java/src/net/i2p/router/peermanager/CapacityCalculator.java @@ -101,10 +101,10 @@ public class CapacityCalculator extends Calculator { val -= failed * stretch; } - if ( (period <= 10*60*1000) && (curRejected.getCurrentEventCount() + curRejected.getLastEventCount() > 0) ) { - //System.out.println("10m period has rejected " + (curRejected.getCurrentEventCount() + curRejected.getLastEventCount()) + " times"); - return 0.0d; - } else + //if ( (period <= 10*60*1000) && (curRejected.getCurrentEventCount() + curRejected.getLastEventCount() > 0) ) { + // //System.out.println("10m period has rejected " + (curRejected.getCurrentEventCount() + curRejected.getLastEventCount()) + " times"); + // return 0.0d; + //} else val -= stretch * (curRejected.getCurrentEventCount() + curRejected.getLastEventCount()); val += GROWTH_FACTOR; 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 62a1f2e780c96a73739ac1f0ab1e255c9e4466b8..c3a736778599e7204c26ffdf58dbc52eed4f0eb4 100644 --- a/router/java/src/net/i2p/router/transport/tcp/ConnectionRunner.java +++ b/router/java/src/net/i2p/router/transport/tcp/ConnectionRunner.java @@ -92,11 +92,9 @@ class ConnectionRunner implements Runnable { msg.timestamp("ConnectionRunner.sendMessage data"); - I2NPMessage timeMessage = null; - if (_lastTimeSend < _context.clock().now() - TIME_SEND_FREQUENCY) { - timeMessage = buildTimeMessage(); - _lastTimeSend = _context.clock().now(); - } + boolean sendTime = false; + if (_lastTimeSend < _context.clock().now() - TIME_SEND_FREQUENCY) + sendTime = true; OutputStream out = _con.getOutputStream(); boolean ok = false; @@ -106,8 +104,10 @@ class ConnectionRunner implements Runnable { synchronized (out) { before = _context.clock().now(); out.write(buf, 0, written); - if (timeMessage != null) - out.write(timeMessage.toByteArray()); + if (sendTime) { + out.write(buildTimeMessage().toByteArray()); + _lastTimeSend = _context.clock().now(); + } out.flush(); after = _context.clock().now(); } diff --git a/router/java/src/net/i2p/router/transport/tcp/MessageHandler.java b/router/java/src/net/i2p/router/transport/tcp/MessageHandler.java index cbe1ee7a56112283499be82f1fd3fb00fcf0ee3c..6232debf3b603e3d12987cd9c5d7f532486775e5 100644 --- a/router/java/src/net/i2p/router/transport/tcp/MessageHandler.java +++ b/router/java/src/net/i2p/router/transport/tcp/MessageHandler.java @@ -54,10 +54,12 @@ public class MessageHandler implements I2NPMessageReader.I2NPMessageEventListene long delta = _con.getRouterContext().clock().now() - remoteTime; if ( (delta > Router.CLOCK_FUDGE_FACTOR) || (delta < 0 - Router.CLOCK_FUDGE_FACTOR) ) { _con.closeConnection(); - _transport.addConnectionErrorMessage("Peer " + _identHash.toBase64().substring(0,6) - + " is too far skewed (" - + DataHelper.formatDuration(delta) + ") after uptime of " - + DataHelper.formatDuration(_con.getLifetime())); + String msg = "Peer " + _identHash.toBase64().substring(0,6) + " is too far skewed (" + + DataHelper.formatDuration(delta) + ") after uptime of " + + DataHelper.formatDuration(_con.getLifetime()); + if (_log.shouldLog(Log.WARN)) + _log.warn(msg); + _transport.addConnectionErrorMessage(msg); _transport.getContext().statManager().addRateData("tcp.disconnectAfterSkew", delta, _con.getLifetime()); } else { int level = Log.DEBUG;