2005-07-21 jrandom

* Fix in the SDK for a bug which would manifest itself as misrouted
      streaming packets when a destination has many concurrent streaming
      connections (thanks duck!)
    * No more "Graceful shutdown in -18140121441141s"
This commit is contained in:
jrandom
2005-07-21 22:37:14 +00:00
committed by zzz
parent 3563aa2e4d
commit 45767360ab
9 changed files with 36 additions and 7 deletions

View File

@ -25,8 +25,11 @@ public class NoticeHelper {
public String getSystemNotice() {
if (_context.router().gracefulShutdownInProgress()) {
return "Graceful shutdown in "
+ DataHelper.formatDuration(_context.router().getShutdownTimeRemaining());
long remaining = _context.router().getShutdownTimeRemaining();
if (remaining > 0)
return "Graceful shutdown in " + DataHelper.formatDuration(remaining);
else
return "Graceful shutdown imminent, please be patient as state is written to disk";
} else {
return "";
}

View File

@ -129,6 +129,8 @@ public class ConnectionManager {
} else {
_connectionByInboundId.put(ba, oldCon);
// receiveId already taken, try another
// (need to realloc receiveId, as ba.getData() points to the old value)
receiveId = new byte[4];
_context.random().nextBytes(receiveId);
}
}

View File

@ -27,8 +27,9 @@ public class ByteArray implements Serializable, Comparable {
}
public ByteArray(byte[] data) {
_offset = 0;
_data = data;
_valid = 0;
_valid = (data != null ? data.length : 0);
}
public ByteArray(byte[] data, int offset, int length) {
_data = data;

View File

@ -37,7 +37,8 @@ public class SessionTag extends ByteArray {
}
public void setData(byte val[]) throws IllegalArgumentException {
if (val == null) super.setData(null);
if (val == null)
throw new NullPointerException("SessionTags cannot be null");
if (val.length != BYTE_LENGTH)
throw new IllegalArgumentException("SessionTags must be " + BYTE_LENGTH + " bytes");
super.setData(val);

View File

@ -1,4 +1,10 @@
$Id: history.txt,v 1.214 2005/07/19 16:00:25 jrandom Exp $
$Id: history.txt,v 1.215 2005/07/20 14:24:47 jrandom Exp $
2005-07-21 jrandom
* Fix in the SDK for a bug which would manifest itself as misrouted
streaming packets when a destination has many concurrent streaming
connections (thanks duck!)
* No more "Graceful shutdown in -18140121441141s"
2005-07-20 jrandom
* Allow the user to specify an external port # for SSU even if the external

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.205 $ $Date: 2005/07/19 16:00:26 $";
public final static String ID = "$Revision: 1.206 $ $Date: 2005/07/20 14:24:47 $";
public final static String VERSION = "0.5.0.7";
public final static long BUILD = 17;
public final static long BUILD = 18;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION);
System.out.println("Router ID: " + RouterVersion.ID);

View File

@ -251,6 +251,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
if (explicitAddressSpecified())
return;
boolean updated = false;
synchronized (this) {
if ( (_externalListenHost == null) ||
(!eq(_externalListenHost.getAddress(), _externalListenPort, ourIP, ourPort)) ) {
@ -259,11 +260,15 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
_externalListenPort = ourPort;
rebuildExternalAddress();
replaceAddress(_externalAddress);
updated = true;
} catch (UnknownHostException uhe) {
_externalListenHost = null;
}
}
}
if (updated)
_context.router().rebuildRouterInfo();
}
private static final boolean eq(byte laddr[], int lport, byte raddr[], int rport) {

View File

@ -24,6 +24,12 @@ public class HopProcessor {
/** helpful flag for debugging */
static final boolean USE_ENCRYPTION = true;
/**
* as of i2p 0.6, the tunnel crypto will change by encrypting the IV both before
* and after using it at each hop so as to prevent a certain type of replay/confirmation
* attack.
*/
static final boolean USE_DOUBLE_IV_ENCRYPTION = false;
static final int IV_LENGTH = 16;
private static final ByteCache _cache = ByteCache.getInstance(128, IV_LENGTH);
@ -78,6 +84,8 @@ public class HopProcessor {
//_log.debug("Before:" + Base64.encode(orig, IV_LENGTH, orig.length - IV_LENGTH));
}
if (USE_ENCRYPTION) {
if (USE_DOUBLE_IV_ENCRYPTION)
updateIV(orig, offset);
encrypt(orig, offset, length);
updateIV(orig, offset);
}

View File

@ -95,5 +95,8 @@ public class OutboundGatewayProcessor {
prev = cur;
cur = xf;
}
if (HopProcessor.USE_DOUBLE_IV_ENCRYPTION)
ctx.aes().decryptBlock(orig, offset, config.getIVKey(), orig, offset);
}
}