[freenet-cvs] r17529 - trunk/freenet/src/freenet/node

toad at freenetproject.org toad at freenetproject.org
Mon Feb 4 23:33:14 UTC 2008


Author: toad
Date: 2008-02-04 23:33:13 +0000 (Mon, 04 Feb 2008)
New Revision: 17529

Modified:
   trunk/freenet/src/freenet/node/FailureTableEntry.java
Log:
Logging.
Don't send an offer to the same node as both requestor and requested.

Modified: trunk/freenet/src/freenet/node/FailureTableEntry.java
===================================================================
--- trunk/freenet/src/freenet/node/FailureTableEntry.java	2008-02-04 23:30:44 UTC (rev 17528)
+++ trunk/freenet/src/freenet/node/FailureTableEntry.java	2008-02-04 23:33:13 UTC (rev 17529)
@@ -4,6 +4,7 @@
 package freenet.node;
 
 import java.lang.ref.WeakReference;
+import java.util.HashSet;
 
 import freenet.keys.Key;
 import freenet.support.Logger;
@@ -306,6 +307,8 @@
 	/** Offer this key to all the nodes that have requested it, and all the nodes it has been requested from.
 	 * Called after a) the data has been stored, and b) this entry has been removed from the FT */
 	public void offer() {
+		HashSet set = new HashSet();
+		if(logMINOR) Logger.minor(this, "Sending offers to nodes which requested the key from us:");
 		for(int i=0;i<requestorNodes.length;i++) {
 			WeakReference ref = requestorNodes[i];
 			if(ref == null) continue;
@@ -313,13 +316,16 @@
 			if(pn == null) continue;
 			if(pn.getBootID() != requestorBootIDs[i]) continue;
 			pn.offer(key);
+			set.add(pn);
 		}
+		if(logMINOR) Logger.minor(this, "Sending offers to nodes which we sent the key to:");
 		for(int i=0;i<requestedNodes.length;i++) {
 			WeakReference ref = requestedNodes[i];
 			if(ref == null) continue;
 			PeerNode pn = (PeerNode) ref.get();
 			if(pn == null) continue;
 			if(pn.getBootID() != requestedBootIDs[i]) continue;
+			if(set.contains(pn)) continue;
 			pn.offer(key);
 		}
 	}




More information about the cvs mailing list