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

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

increase the (essentially) arbitrary choke on message send times (which has...

increase the (essentially) arbitrary choke on message send times (which has caused some reliability problems under load)
parent 8add4339
No related branches found
No related tags found
No related merge requests found
...@@ -432,6 +432,13 @@ class TCPConnection implements I2NPMessageReader.I2NPMessageEventListener { ...@@ -432,6 +432,13 @@ class TCPConnection implements I2NPMessageReader.I2NPMessageEventListener {
_log.warn("Error reading from stream to " + _remoteIdentity.getHash().toBase64(), error); _log.warn("Error reading from stream to " + _remoteIdentity.getHash().toBase64(), error);
} }
/**
* If we are taking an absurdly long time to send out a message, drop it
* since we're overloaded.
*
*/
private static final long MAX_LIFETIME_BEFORE_OUTBOUND_EXPIRE = 15*1000;
class ConnectionRunner implements Runnable { class ConnectionRunner implements Runnable {
private boolean _running; private boolean _running;
public void run() { public void run() {
...@@ -494,7 +501,7 @@ class TCPConnection implements I2NPMessageReader.I2NPMessageEventListener { ...@@ -494,7 +501,7 @@ class TCPConnection implements I2NPMessageReader.I2NPMessageEventListener {
long lifetime = cur.timestamp("TCPConnection.runner.locked_expireOldMessages still ok with " long lifetime = cur.timestamp("TCPConnection.runner.locked_expireOldMessages still ok with "
+ (i) + " ahead and " + (_toBeSent.size()-i-1) + (i) + " ahead and " + (_toBeSent.size()-i-1)
+ " behind on the queue"); + " behind on the queue");
if (lifetime > 5*1000) { if (lifetime > MAX_LIFETIME_BEFORE_OUTBOUND_EXPIRE) {
cur.timestamp("TCPConnection.runner.locked_expireOldMessages lifetime too long - " + lifetime); cur.timestamp("TCPConnection.runner.locked_expireOldMessages lifetime too long - " + lifetime);
if (timedOut == null) if (timedOut == null)
timedOut = new ArrayList(2); timedOut = new ArrayList(2);
......
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