forked from I2P_Developers/i2p.i2p
* RoutingKeyGenerator: Cleanups (ticket #672)
This commit is contained in:
@ -57,7 +57,9 @@ public class RoutingKeyGenerator {
|
||||
private volatile long _lastChanged;
|
||||
|
||||
private final static Calendar _cal = GregorianCalendar.getInstance(TimeZone.getTimeZone("GMT"));
|
||||
private final static SimpleDateFormat _fmt = new SimpleDateFormat("yyyyMMdd");
|
||||
private static final String FORMAT = "yyyyMMdd";
|
||||
private static final int LENGTH = FORMAT.length();
|
||||
private final static SimpleDateFormat _fmt = new SimpleDateFormat(FORMAT);
|
||||
|
||||
public byte[] getModData() {
|
||||
return _currentModData;
|
||||
@ -74,9 +76,7 @@ public class RoutingKeyGenerator {
|
||||
* @return true if changed
|
||||
*/
|
||||
public synchronized boolean generateDateBasedModData() {
|
||||
Date today = null;
|
||||
long now = _context.clock().now();
|
||||
synchronized (_cal) {
|
||||
_cal.setTime(new Date(now));
|
||||
_cal.set(Calendar.YEAR, _cal.get(Calendar.YEAR)); // gcj <= 4.0 workaround
|
||||
_cal.set(Calendar.DAY_OF_YEAR, _cal.get(Calendar.DAY_OF_YEAR)); // gcj <= 4.0 workaround
|
||||
@ -84,12 +84,13 @@ public class RoutingKeyGenerator {
|
||||
_cal.set(Calendar.MINUTE, 0);
|
||||
_cal.set(Calendar.SECOND, 0);
|
||||
_cal.set(Calendar.MILLISECOND, 0);
|
||||
today = _cal.getTime();
|
||||
}
|
||||
Date today = _cal.getTime();
|
||||
|
||||
String modVal = _fmt.format(today);
|
||||
byte[] mod = new byte[modVal.length()];
|
||||
for (int i = 0; i < modVal.length(); i++)
|
||||
if (modVal.length() != LENGTH)
|
||||
throw new IllegalStateException();
|
||||
byte[] mod = new byte[LENGTH];
|
||||
for (int i = 0; i < LENGTH; i++)
|
||||
mod[i] = (byte)(modVal.charAt(i) & 0xFF);
|
||||
boolean changed = !DataHelper.eq(_currentModData, mod);
|
||||
if (changed) {
|
||||
@ -112,9 +113,9 @@ public class RoutingKeyGenerator {
|
||||
*/
|
||||
public Hash getRoutingKey(Hash origKey) {
|
||||
if (origKey == null) throw new IllegalArgumentException("Original key is null");
|
||||
byte modVal[] = new byte[Hash.HASH_LENGTH + _currentModData.length];
|
||||
byte modVal[] = new byte[Hash.HASH_LENGTH + LENGTH];
|
||||
System.arraycopy(origKey.getData(), 0, modVal, 0, Hash.HASH_LENGTH);
|
||||
System.arraycopy(_currentModData, 0, modVal, Hash.HASH_LENGTH, _currentModData.length);
|
||||
System.arraycopy(_currentModData, 0, modVal, Hash.HASH_LENGTH, LENGTH);
|
||||
return SHA256Generator.getInstance().calculateHash(modVal);
|
||||
}
|
||||
|
||||
|
24
history.txt
24
history.txt
@ -1,3 +1,27 @@
|
||||
2012-07-30 zzz
|
||||
* build.xml: Move more default properties to build.properties
|
||||
* DecayingBloomFilter, DecayingHashSet, xlattice filters:
|
||||
- Move from core to router
|
||||
- Comment out tests
|
||||
* ElGamal/AES/SessionTag:
|
||||
- Increase TX expire from 10 to 12 min, while keeping RX expire at 15 min.
|
||||
3 minutes should be plenty of clock skew + delay.
|
||||
- Move tags-to-send and low-threshold values to be per-SKM
|
||||
- New session config options crypto.tagsToSend and crypto.lowTagThreshold
|
||||
- Prep for per-packet override of tags and thresholds
|
||||
- Cleanups and Javadocs
|
||||
* GarlicMessageBuilder:
|
||||
- Put data clove last to speed acks and leaseset store on far end
|
||||
* I2PTunnel: Add some defaults for the new session config options
|
||||
* OCMOSJ:
|
||||
- Don't bundle LeaseSet just because we're requesting an ACK
|
||||
- Changed session config option shouldBundleReplyInfo to default to true
|
||||
and be used to disable bundling altogether when set to false.
|
||||
Was previously an undocumented option to force bundling with a certain probability.
|
||||
- Don't send tags unless we've already generated a reply token (race)
|
||||
- Cleanups and Javadocs
|
||||
* RoutingKeyGenerator: Cleanups (ticket #672)
|
||||
|
||||
* 2012-07-30 0.9.1 released
|
||||
|
||||
2012-07-28 str4d
|
||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Monotone";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 0;
|
||||
public final static long BUILD = 1;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
|
Reference in New Issue
Block a user