From e23f3b4875857592fdea8c66f0c5d608d4332228 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Sat, 2 Nov 2013 14:10:06 +0000
Subject: [PATCH] comments

---
 .../java/src/net/i2p/data/i2np/I2NPMessageImpl.java | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/router/java/src/net/i2p/data/i2np/I2NPMessageImpl.java b/router/java/src/net/i2p/data/i2np/I2NPMessageImpl.java
index 914f2f708c..97635e0a90 100644
--- a/router/java/src/net/i2p/data/i2np/I2NPMessageImpl.java
+++ b/router/java/src/net/i2p/data/i2np/I2NPMessageImpl.java
@@ -63,6 +63,7 @@ public abstract class I2NPMessageImpl extends DataStructureImpl implements I2NPM
         _context = context;
         _log = context.logManager().getLog(I2NPMessageImpl.class);
         _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);
         //_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 });
@@ -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; }
+
+    /**
+     *  The ID is set to a random value in the constructor but it can be overridden here.
+     */
     public void setUniqueId(long id) { _uniqueId = id; }
     
     /**
@@ -258,10 +263,14 @@ public abstract class I2NPMessageImpl extends DataStructureImpl implements I2NPM
      *
      */
     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 synchronized int getMessageSize() { 
-        return calculateWrittenLength()+15 + CHECKSUM_LENGTH; // 16 bytes in the header
+        return calculateWrittenLength() + (15 + CHECKSUM_LENGTH); // 16 bytes in the header
     }
 
     /**
-- 
GitLab