2005-01-15 jrandom

* Caught a series of (previously unhandled) errors caused by requeueing
      messages that had timed out on the TCP transport (thanks mae^!)
    * Reduce the barrier to dropping session tags on streaming lib resends -
      every fourth send should drop the tags, forcing ElGamal encryption.  This
      will help speed up the recovery after a disconnect, rather than the drop
      every fifth send.
This commit is contained in:
jrandom
2005-01-15 21:03:14 +00:00
committed by zzz
parent c48875a6fb
commit ecd971c0e5
6 changed files with 55 additions and 37 deletions

View File

@ -831,7 +831,7 @@ public class Connection {
// in case things really suck, the other side may have lost thier
// session tags (e.g. they restarted), so jump back to ElGamal.
int failTagsAt = _options.getMaxResends() - 1;
int failTagsAt = _options.getMaxResends() - 2;
if ( (newWindowSize == 1) && (numSends == failTagsAt) ) {
if (_log.shouldLog(Log.WARN))
_log.warn("Optimistically failing tags at resend " + numSends);

View File

@ -1,4 +1,12 @@
$Id: history.txt,v 1.125 2005/01/05 19:17:53 jrandom Exp $
$Id: history.txt,v 1.126 2005/01/06 15:59:13 jrandom Exp $
2005-01-15 jrandom
* Caught a series of (previously unhandled) errors caused by requeueing
messages that had timed out on the TCP transport (thanks mae^!)
* Reduce the barrier to dropping session tags on streaming lib resends -
every fourth send should drop the tags, forcing ElGamal encryption. This
will help speed up the recovery after a disconnect, rather than the drop
every fifth send.
* 2005-01-06 0.4.2.6 released

View File

@ -41,6 +41,12 @@ public class OutNetMessagePool {
*
*/
public void add(OutNetMessage msg) {
boolean valid = validate(msg);
if (!valid) {
_context.messageRegistry().unregisterPending(msg);
return;
}
if (_log.shouldLog(Log.INFO))
_log.info("Adding outbound message to "
+ msg.getTarget().getIdentity().getHash().toBase64().substring(0,6)
@ -48,11 +54,6 @@ public class OutNetMessagePool {
+ " expiring on " + msg.getMessage().getMessageExpiration()
+ " of type " + msg.getMessageType());
boolean valid = validate(msg);
if (!valid) {
_context.messageRegistry().unregisterPending(msg);
return;
}
MessageSelector selector = msg.getReplySelector();
if (selector != null) {
_context.messageRegistry().registerPending(msg);

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.130 $ $Date: 2005/01/05 19:17:54 $";
public final static String ID = "$Revision: 1.131 $ $Date: 2005/01/06 15:59:13 $";
public final static String VERSION = "0.4.2.6";
public final static long BUILD = 0;
public final static long BUILD = 1;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION);
System.out.println("Router ID: " + RouterVersion.ID);

View File

@ -164,7 +164,8 @@ public abstract class TransportImpl implements Transport {
_context.statManager().addRateData("transport.expiredOnQueueLifetime", lifetime, lifetime);
if (allowRequeue) {
if ( (msg.getExpiration() <= 0) || (msg.getExpiration() > _context.clock().now()) ) {
if ( ( (msg.getExpiration() <= 0) || (msg.getExpiration() > _context.clock().now()) )
&& (msg.getMessage() != null) ) {
// this may not be the last transport available - keep going
_context.outNetMessagePool().add(msg);
// don't discard the data yet!

View File

@ -23,36 +23,44 @@ public class TCPConnectionEstablisher implements Runnable {
public void run() {
while (true) {
RouterInfo info = _transport.getNextPeer();
if (info == null) {
try { Thread.sleep(5*1000); } catch (InterruptedException ie) {}
continue;
}
ConnectionBuilder cb = new ConnectionBuilder(_context, _transport, info);
TCPConnection con = null;
try {
con = cb.establishConnection();
loop();
} catch (Exception e) {
_log.log(Log.CRIT, "Unhandled exception establishing a connection to "
+ info.getIdentity().getHash().toBase64(), e);
_log.log(Log.CRIT, "wtf, establisher b0rked. send this stack trace to jrandom", e);
}
if (con != null) {
_transport.connectionEstablished(con);
} else {
if (!_context.router().isAlive()) return;
_transport.addConnectionErrorMessage(cb.getError());
Hash peer = info.getIdentity().getHash();
_context.profileManager().commErrorOccurred(peer);
_context.shitlist().shitlistRouter(peer, "Unable to contact");
_context.netDb().fail(peer);
}
// this removes the _pending block on the address and
// identity we attempted to contact. if the peer changed
// identities, any additional _pending blocks will also have
// been cleared above with .connectionEstablished
_transport.establishmentComplete(info);
}
}
private void loop() {
RouterInfo info = _transport.getNextPeer();
if (info == null) {
try { Thread.sleep(5*1000); } catch (InterruptedException ie) {}
return;
}
ConnectionBuilder cb = new ConnectionBuilder(_context, _transport, info);
TCPConnection con = null;
try {
con = cb.establishConnection();
} catch (Exception e) {
_log.log(Log.CRIT, "Unhandled exception establishing a connection to "
+ info.getIdentity().getHash().toBase64(), e);
}
if (con != null) {
_transport.connectionEstablished(con);
} else {
if (!_context.router().isAlive()) return;
_transport.addConnectionErrorMessage(cb.getError());
Hash peer = info.getIdentity().getHash();
_context.profileManager().commErrorOccurred(peer);
_context.shitlist().shitlistRouter(peer, "Unable to contact");
_context.netDb().fail(peer);
}
// this removes the _pending block on the address and
// identity we attempted to contact. if the peer changed
// identities, any additional _pending blocks will also have
// been cleared above with .connectionEstablished
_transport.establishmentComplete(info);
}
}