Compare commits

..

11 Commits

Author SHA1 Message Date
jrandom
1ebb0ac5fb 0.3.1.4 (backwards compatible)
i'll package & push later this evening
2004-05-23 16:54:29 +00:00
jrandom
bf0e53f13b i'll swallow your soul!
er... make it queue up to 20 messages (in case of bursts), and do some more verbose logging
2004-05-23 16:52:56 +00:00
jrandom
8888a960c0 logging 2004-05-23 16:51:30 +00:00
jrandom
04be41aac5 if the send queue to the peer is too large, fail the message but also mark it as a comm error (since either their net con is insanely saturated, or disconnected)
logging
2004-05-22 12:05:34 +00:00
jrandom
fd1313d49f bugger the speed estimate - always use the measured values, and if there aren't enough measured values, use 0. 2004-05-22 12:03:38 +00:00
jrandom
3599dba5c3 javadoc 2004-05-22 12:02:51 +00:00
jrandom
67edc437d2 properly !LART on comm error, and initialize the log correctly 2004-05-22 12:02:18 +00:00
jrandom
7a39d9240c logging 2004-05-22 12:00:08 +00:00
jrandom
6d2d9aed7e correctly handle no reachable NTP servers 2004-05-22 01:51:07 +00:00
duck
3c2e5f22b6 added ogg.baffled.i2p
(duck)
2004-05-21 22:48:28 +00:00
jrandom
ddb6348bfd type safety? we dont need no stinkin' type safety!
(aka expiration vs timeoutMs, as shown by tunnel test messages that don't expire for another 30 years)
this'll leak memory for failed tunnels, so we'll push this in a new rev in the next day or two, or maybe later today if it gets really bad.
2004-05-20 13:43:09 +00:00
11 changed files with 54 additions and 36 deletions

View File

@@ -50,13 +50,13 @@ public class Timestamper implements Runnable {
while (true) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Querying servers " + _serverList);
long now = NtpClient.currentTime(_serverList);
if (now < 0) {
_log.error("Unable to contact any of the NTP servers - network disconnect?");
} else {
try {
long now = NtpClient.currentTime(_serverList);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Stamp time");
stampTime(now);
} catch (IllegalArgumentException iae) {
_log.log(Log.CRIT, "Unable to reach any of the NTP servers - network disconnected?");
}
try { Thread.sleep(DELAY_MS); } catch (InterruptedException ie) {}
}

View File

@@ -14,8 +14,8 @@ package net.i2p;
*
*/
public class CoreVersion {
public final static String ID = "$Revision: 1.6 $ $Date: 2004/05/13 18:49:08 $";
public final static String VERSION = "0.3.1.3";
public final static String ID = "$Revision: 1.7 $ $Date: 2004/05/20 06:32:32 $";
public final static String VERSION = "0.3.1.4";
public static void main(String args[]) {
System.out.println("I2P Core version: " + VERSION);

View File

@@ -27,7 +27,7 @@ class PersistenceHelper {
try {
return Long.parseLong(val);
} catch (NumberFormatException nfe) {
_log.error("Error formatting " + val + " into a long", nfe);
_log.warn("Error formatting " + val + " into a long", nfe);
}
} else {
_log.warn("Key " + prefix + name + " does not exist");
@@ -41,10 +41,10 @@ class PersistenceHelper {
try {
return Double.parseDouble(val);
} catch (NumberFormatException nfe) {
_log.error("Error formatting " + val + " into a double", nfe);
_log.warn("Error formatting " + val + " into a double", nfe);
}
} else {
_log.error("Key " + prefix + name + " does not exist");
_log.warn("Key " + prefix + name + " does not exist");
}
return 0;
}

View File

@@ -1,6 +1,7 @@
; TC's hosts.txt guaranteed freshness
; $Id: hosts.txt,v 1.6 2004/05/15 23:42:17 jrandom Exp $
; $Id: hosts.txt,v 1.7 2004/05/17 00:46:06 jrandom Exp $
; changelog:
; (1.34) added ogg.baffled.i2p
; (1.33) added morph.i2p
; (1.32) added nickster.i2p
; (1.31) added mush.zeit.i2p (i2p's first eepMUSH)
@@ -90,4 +91,5 @@ xilog.i2p=yHOthRzTaowYM0dH0H8LfHeBpNzfVnBL9TtVSPF1bAImcm0tI1jyw4dERfijVunXviLGQ0
mush.zeit.i2p=3mYATMQg83VtUln0eEi9-LZYJ-0wCuhFu5PnDV6mYWFnLwbPf2rG22jyhOBw2h1fXcj3lJg7VnLRx-PGYQIWsIle~z1FBrOyT9ydqGrjbQYJ0bqBYUnWSR-xuHOGWiJ8lH34uqZ~j~owvhH-NAKs332BkSCl36HsjJF46i00ICS4qxJQ9l7YBtGYAvoliMN4rz0FETPsvwroyQ7JptfovHe1yviF5bfjeZ9ITP5EpYpyOVtfR7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9kZygVsMcSOoMZ8HENQLxo9CQwn4CxMZ33uk1o4PV2JpLHWaX075UY9YroHsNJRAuV6LGm-3guKH~P3k7j4wlwLLFzMjeMrhrNsUGrYyx8n4d6kU6EvhiJOA0suVud1cDUkAuxoAZv04CvSvJ5-cgIDvjZFb1jCQpwKvgmWYhJNSs8dhrm2f~EdgFAvPHfjHLz2c7~opMMK-6dXSH1tR~mtIYmnPip5AAAA
ogg.baffled.i2p=~FkFF79EA9udRvT740pj07ffO9D5j7kPCih0qj4JvS5tNJdpEMj~D9l-K4J3SKC11T-lwduq9H2j6Ax5dvZXo2TRaSMH0QugGscam2FylydhmxQdST8KiTPtV3kipF5I0~Fwl5TO-~wz4kpQTrR0UwliVwBBz2NfhD2-wTJN43LE-11xH45QvQ0Hl666tkOadXhcy9IKABJuiXj6mfNLdiRsGg0ds3LQYPvWUloUCR0ZOwdJ3wxOJSYf6oSH0sbGX9Lh6-sOgDFbCkwKmo7ftyr0n-kMbvjyvtPGYx0EKz-5-2bOlpQ9OFU7fgrqCmvWqQmLMgonddNz0DWzggigB5msYnKEuKrcwqJ53NMEyT1KUNW29vtSriglSLeoFRPGtAN5D5nzH2EWXBG8l~3eGANDnj~rVBhk2SP4oNrxjII6stdz25pKyK9zXUErp7R2J9U6jGzBOm0hYdRl0jNR4DyqaHE8t0qGimJX82~3QVA6hmB09E21Grqqp2noZvoEAAAA

View File

@@ -15,8 +15,8 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.5 $ $Date: 2004/05/13 18:49:09 $";
public final static String VERSION = "0.3.1.3";
public final static String ID = "$Revision: 1.6 $ $Date: 2004/05/20 06:32:32 $";
public final static String VERSION = "0.3.1.4";
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION);
System.out.println("Router ID: " + RouterVersion.ID);

View File

@@ -305,8 +305,9 @@ public class ClientConnectionRunner {
long after = _context.clock().now();
long lag = after - before;
if (lag > 300) {
_log.error("synchronization on the i2cp message send took too long (" + lag
+ "ms): " + msg, new Exception("I2CP Lag"));
if (_log.shouldLog(Log.WARN))
_log.warn("synchronization on the i2cp message send took too long (" + lag
+ "ms): " + msg);
}
}
}

View File

@@ -27,6 +27,7 @@ public class ProfileManagerImpl implements ProfileManager {
public ProfileManagerImpl(RouterContext context) {
_context = context;
_log = _context.logManager().getLog(ProfileManagerImpl.class);
}
/**
@@ -73,8 +74,8 @@ public class ProfileManagerImpl implements ProfileManager {
PeerProfile data = getProfile(peer);
if (data == null) return;
data.setLastSendFailed(_context.clock().now());
data.getSendFailureSize().addData(0, 0); // yeah, should be a frequency...
data.getCommError().addData(0, 0); // see above
data.getSendFailureSize().addData(1, 0); // yeah, should be a frequency...
data.getCommError().addData(1, 0); // see above
}
/**

View File

@@ -67,7 +67,7 @@ public class ProfileOrganizer {
/**
* Defines the minimum number of 'fast' peers that the organizer should select. See
* {@see getMinimumFastPeers}
* {@link ProfileOrganizer#getMinimumFastPeers}
*
*/
public static final String PROP_MINIMUM_FAST_PEERS = "profileOrganizer.minFastPeers";
@@ -714,7 +714,7 @@ public class ProfileOrganizer {
*
* @return minimum number of peers to be placed in the 'fast+reliable' group
*/
private int getMinimumFastPeers() {
protected int getMinimumFastPeers() {
if (_context.router() != null) {
String val = _context.router().getConfigSetting(PROP_MINIMUM_FAST_PEERS);
if (val != null) {

View File

@@ -91,6 +91,7 @@ public class SpeedCalculator extends Calculator {
*
*/
private double getEstimateFactor(long eventThreshold, long numEvents) {
if (true) return 0.0d; // never use the estimate
if (numEvents > eventThreshold)
return 0.0d;
else

View File

@@ -17,7 +17,6 @@ import java.math.BigInteger;
import java.net.Socket;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import net.i2p.crypto.AESInputStream;
@@ -69,7 +68,7 @@ class TCPConnection implements I2NPMessageReader.I2NPMessageEventListener {
protected RouterContext _context;
public final static String PARAM_MAX_QUEUED_MESSAGES = "i2np.tcp.maxQueuedMessages";
private final static int DEFAULT_MAX_QUEUED_MESSAGES = 10;
private final static int DEFAULT_MAX_QUEUED_MESSAGES = 20;
public TCPConnection(RouterContext context, Socket s, boolean locallyInitiated) {
_context = context;
@@ -256,14 +255,21 @@ class TCPConnection implements I2NPMessageReader.I2NPMessageEventListener {
int totalPending = 0;
boolean fail = false;
long beforeAdd = _context.clock().now();
StringBuffer pending = new StringBuffer(64);
synchronized (_toBeSent) {
if ( (_maxQueuedMessages > 0) && (_toBeSent.size() >= _maxQueuedMessages) ) {
fail = true;
} else {
_toBeSent.add(msg);
totalPending = _toBeSent.size();
// the ConnectionRunner.processSlice does a wait() until we have messages
}
totalPending = _toBeSent.size();
pending.append(totalPending).append(": ");
for (int i = 0; i < totalPending; i++) {
OutNetMessage cur = (OutNetMessage)_toBeSent.get(i);
pending.append(cur.getMessage().getClass().getName());
pending.append(" added ").append(cur.getLifetime()).append(" ms ago, ");
}
_toBeSent.notifyAll();
}
long afterAdd = _context.clock().now();
@@ -272,8 +278,11 @@ class TCPConnection implements I2NPMessageReader.I2NPMessageEventListener {
if (fail) {
if (_log.shouldLog(Log.ERROR))
_log.error("too many queued messages to " + _remoteIdentity.getHash().toBase64() + ": " + totalPending);
_log.error("too many queued messages to " + _remoteIdentity.getHash().toBase64() + ": " + pending.toString());
// do we really want to give them a comm error because they're so.damn.slow reading their stream?
_context.profileManager().commErrorOccurred(_remoteIdentity.getHash());
msg.timestamp("TCPConnection.addMessage exceeded max queued");
_transport.afterSend(msg, false);
return;
@@ -281,8 +290,9 @@ class TCPConnection implements I2NPMessageReader.I2NPMessageEventListener {
long diff = afterAdd - beforeAdd;
if (diff > 500) {
if (_log.shouldLog(Log.ERROR))
_log.error("Lock contention adding a message: " + diff + "ms");
if (_log.shouldLog(Log.WARN))
_log.warn("Lock contention adding a message: " + diff + "ms to "
+ _remoteIdentity.getHash().toBase64() + ": " + totalPending);
}
msg.timestamp("TCPConnection.addMessage after toBeSent.add and notify");
@@ -299,7 +309,7 @@ class TCPConnection implements I2NPMessageReader.I2NPMessageEventListener {
long sliceTime = _context.clock().now()-_lastSliceRun;
_log.error("onAdd: Slices are taking too long (" + sliceTime
+ "ms) - perhaps the remote side is disconnected or hung? remote="
+ _remoteIdentity.getHash().toBase64());
+ _remoteIdentity.getHash().toBase64() + " pending: " + pending.toString());
}
closeConnection();
}
@@ -437,7 +447,7 @@ class TCPConnection implements I2NPMessageReader.I2NPMessageEventListener {
OutNetMessage msg = null;
int remaining = 0;
List timedOut = new LinkedList();
List timedOut = null;
synchronized (_toBeSent) {
// loop through, dropping expired messages, waiting until a non-expired
@@ -453,21 +463,24 @@ class TCPConnection implements I2NPMessageReader.I2NPMessageEventListener {
msg = (OutNetMessage)_toBeSent.remove(0);
remaining--;
if ( (msg.getExpiration() > 0) && (msg.getExpiration() < start) ) {
if (timedOut == null) timedOut = new ArrayList(4);
timedOut.add(msg);
msg = null; // keep looking
}
}
}
for (Iterator iter = timedOut.iterator(); iter.hasNext(); ) {
OutNetMessage failed = (OutNetMessage)iter.next();
if (_log.shouldLog(Log.WARN))
_log.warn("Message timed out while sitting on the TCP Connection's queue! was too slow by: "
+ (start-msg.getExpiration()) + "ms to "
+ _remoteIdentity.getHash().toBase64() + ": " + msg);
msg.timestamp("TCPConnection.runner.processSlice expired");
_transport.afterSend(msg, false);
return true;
if (timedOut != null) {
for (int i = 0; i < timedOut.size(); i++) {
OutNetMessage failed = (OutNetMessage)timedOut.get(i);
if (_log.shouldLog(Log.WARN))
_log.warn("Message timed out while sitting on the TCP Connection's queue! was too slow by: "
+ (start-msg.getExpiration()) + "ms to "
+ _remoteIdentity.getHash().toBase64() + ": " + msg);
msg.timestamp("TCPConnection.runner.processSlice expired");
_transport.afterSend(msg, false);
return true;
}
}
if (remaining > 0) {

View File

@@ -121,7 +121,7 @@ class TestTunnelJob extends JobImpl {
TestFailedJob failureJob = new TestFailedJob();
MessageSelector selector = new TestMessageSelector(msg.getMessageId(), info.getTunnelId().getTunnelId());
SendTunnelMessageJob j = new SendTunnelMessageJob(_context, msg, _secondaryId, info.getThisHop(), info.getTunnelId(), null, new TestSuccessfulJob(), failureJob, selector, _context.clock().now()+TEST_TIMEOUT, TEST_PRIORITY);
SendTunnelMessageJob j = new SendTunnelMessageJob(_context, msg, _secondaryId, info.getThisHop(), info.getTunnelId(), null, new TestSuccessfulJob(), failureJob, selector, TEST_TIMEOUT, TEST_PRIORITY);
_context.jobQueue().addJob(j);
}