Author: toad
Date: 2007-08-22 20:52:29 +0000 (Wed, 22 Aug 2007)
New Revision: 14841
Modified:
trunk/freenet/src/freenet/node/LocationManager.java
Log:
better document the fact that we do allow loops
Modified: trunk/freenet/src/freenet/node/LocationManager.java
===================================================================
--- trunk/freenet/src/freenet/node/LocationManager.java 2007-08-22 20:36:43 UTC
(rev 14840)
+++ trunk/freenet/src/freenet/node/LocationManager.java 2007-08-22 20:52:29 UTC
(rev 14841)
@@ -709,11 +709,13 @@
long oldID = m.getLong(DMT.UID);
Long luid = new Long(oldID);
long newID = oldID+1;
- // We have two separate IDs so we can deal with two visits
- // separately. This is because we want it to be as random
- // as possible.
- // This means we can and should check for the same ID being
- // sent twice.
+ /**
+ * UID is used to record the state i.e. UID x, came in from node a,
forwarded to node b.
+ * We increment it on each hop, because in order for the node
selection to be as random as
+ * possible we *must allow loops*! I.e. the same swap chain may pass
over the same node
+ * twice or more. However, if we get a request with either the
incoming or the outgoing
+ * UID, we can safely kill it as it's clearly the result of a bug.
+ */
RecentlyForwardedItem item = (RecentlyForwardedItem)
recentlyForwardedIDs.get(luid);
if(item != null) {
if(logMINOR) Logger.minor(this, "Rejecting - same ID as
previous request");