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

Skip to content
Snippets Groups Projects
Commit e23f3b48 authored by zzz's avatar zzz
Browse files

comments

parent 06ea9af7
No related branches found
No related tags found
No related merge requests found
...@@ -63,6 +63,7 @@ public abstract class I2NPMessageImpl extends DataStructureImpl implements I2NPM ...@@ -63,6 +63,7 @@ public abstract class I2NPMessageImpl extends DataStructureImpl implements I2NPM
_context = context; _context = context;
_log = context.logManager().getLog(I2NPMessageImpl.class); _log = context.logManager().getLog(I2NPMessageImpl.class);
_expiration = _context.clock().now() + DEFAULT_EXPIRATION_MS; _expiration = _context.clock().now() + DEFAULT_EXPIRATION_MS;
// FIXME/TODO set only for outbound, or only on write, or something, to not waste entropy
_uniqueId = _context.random().nextLong(MAX_ID_VALUE); _uniqueId = _context.random().nextLong(MAX_ID_VALUE);
//_context.statManager().createRateStat("i2np.writeTime", "How long it takes to write an I2NP message", "I2NP", new long[] { 10*60*1000, 60*60*1000 }); //_context.statManager().createRateStat("i2np.writeTime", "How long it takes to write an I2NP message", "I2NP", new long[] { 10*60*1000, 60*60*1000 });
//_context.statManager().createRateStat("i2np.readTime", "How long it takes to read an I2NP message", "I2NP", new long[] { 10*60*1000, 60*60*1000 }); //_context.statManager().createRateStat("i2np.readTime", "How long it takes to read an I2NP message", "I2NP", new long[] { 10*60*1000, 60*60*1000 });
...@@ -248,9 +249,13 @@ public abstract class I2NPMessageImpl extends DataStructureImpl implements I2NPM ...@@ -248,9 +249,13 @@ public abstract class I2NPMessageImpl extends DataStructureImpl implements I2NPM
} }
/** /**
* Replay resistent message Id * Replay resistant message Id
*/ */
public long getUniqueId() { return _uniqueId; } public long getUniqueId() { return _uniqueId; }
/**
* The ID is set to a random value in the constructor but it can be overridden here.
*/
public void setUniqueId(long id) { _uniqueId = id; } public void setUniqueId(long id) { _uniqueId = id; }
/** /**
...@@ -258,10 +263,14 @@ public abstract class I2NPMessageImpl extends DataStructureImpl implements I2NPM ...@@ -258,10 +263,14 @@ public abstract class I2NPMessageImpl extends DataStructureImpl implements I2NPM
* *
*/ */
public long getMessageExpiration() { return _expiration; } public long getMessageExpiration() { return _expiration; }
/**
* The expiration is set to one minute from now in the constructor but it can be overridden here.
*/
public void setMessageExpiration(long exp) { _expiration = exp; } public void setMessageExpiration(long exp) { _expiration = exp; }
public synchronized int getMessageSize() { public synchronized int getMessageSize() {
return calculateWrittenLength()+15 + CHECKSUM_LENGTH; // 16 bytes in the header return calculateWrittenLength() + (15 + CHECKSUM_LENGTH); // 16 bytes in the header
} }
/** /**
......
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