i'll swallow your soul!

er... make it queue up to 20 messages (in case of bursts), and do some more verbose logging
This commit is contained in:
jrandom
2004-05-23 16:52:56 +00:00
committed by zzz
parent 8888a960c0
commit bf0e53f13b

View File

@ -68,7 +68,7 @@ class TCPConnection implements I2NPMessageReader.I2NPMessageEventListener {
protected RouterContext _context; protected RouterContext _context;
public final static String PARAM_MAX_QUEUED_MESSAGES = "i2np.tcp.maxQueuedMessages"; 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) { public TCPConnection(RouterContext context, Socket s, boolean locallyInitiated) {
_context = context; _context = context;
@ -264,12 +264,11 @@ class TCPConnection implements I2NPMessageReader.I2NPMessageEventListener {
// the ConnectionRunner.processSlice does a wait() until we have messages // the ConnectionRunner.processSlice does a wait() until we have messages
} }
totalPending = _toBeSent.size(); totalPending = _toBeSent.size();
if (fail) {
pending.append(totalPending).append(": "); pending.append(totalPending).append(": ");
for (int i = 0; i < totalPending; i++) { for (int i = 0; i < totalPending; i++) {
OutNetMessage cur = (OutNetMessage)_toBeSent.get(i); OutNetMessage cur = (OutNetMessage)_toBeSent.get(i);
pending.append(cur.getMessage().getClass().getName()).append(" "); pending.append(cur.getMessage().getClass().getName());
} pending.append(" added ").append(cur.getLifetime()).append(" ms ago, ");
} }
_toBeSent.notifyAll(); _toBeSent.notifyAll();
} }
@ -310,7 +309,7 @@ class TCPConnection implements I2NPMessageReader.I2NPMessageEventListener {
long sliceTime = _context.clock().now()-_lastSliceRun; long sliceTime = _context.clock().now()-_lastSliceRun;
_log.error("onAdd: Slices are taking too long (" + sliceTime _log.error("onAdd: Slices are taking too long (" + sliceTime
+ "ms) - perhaps the remote side is disconnected or hung? remote=" + "ms) - perhaps the remote side is disconnected or hung? remote="
+ _remoteIdentity.getHash().toBase64()); + _remoteIdentity.getHash().toBase64() + " pending: " + pending.toString());
} }
closeConnection(); closeConnection();
} }