I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit cbc89376 authored by jrandom's avatar jrandom Committed by zzz
Browse files

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
parent 66aa29e3
No related branches found
No related tags found
No related merge requests found
$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
......
......@@ -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");
......
......@@ -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);
......
......@@ -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;
......
......@@ -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();
}
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment