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

toad at freenetproject.org toad at freenetproject.org
Sun Feb 3 00:10:40 UTC 2008


Author: toad
Date: 2008-02-03 00:10:40 +0000 (Sun, 03 Feb 2008)
New Revision: 17497

Modified:
   trunk/freenet/src/freenet/node/FailureTableEntry.java
Log:
Clarify

Modified: trunk/freenet/src/freenet/node/FailureTableEntry.java
===================================================================
--- trunk/freenet/src/freenet/node/FailureTableEntry.java	2008-02-03 00:04:44 UTC (rev 17496)
+++ trunk/freenet/src/freenet/node/FailureTableEntry.java	2008-02-03 00:10:40 UTC (rev 17497)
@@ -101,9 +101,10 @@
 	
 	synchronized void addRequestors(PeerNode[] requestors, long now) {
 		receivedTime = now;
+		/** The number of new requestor elements. These are moved to the beginning and the 
+		 * rest is nulled out. */
 		int notIncluded = 0;
 		int nulls = 0;
-		int ptr = 0;
 		for(int i=0;i<requestors.length;i++) {
 			PeerNode req = requestors[i];
 			boolean requestorIncluded = false;
@@ -126,11 +127,10 @@
 				}
 			}
 			if(!requestorIncluded) {
-				notIncluded++;
-				requestors[ptr++] = requestors[i];
+				requestors[notIncluded++] = requestors[i];
 			} // if it's new, keep it in requestors
 		}
-		for(int i=ptr;i<requestors.length;i++) requestors[i] = null;
+		for(int i=notIncluded;i<requestors.length;i++) requestors[i] = null;
 		if(notIncluded == 0 && nulls == 0) return;
 		// Because weak, these can become null; doesn't matter, but we want to minimise memory usage
 		if(notIncluded == nulls) {
@@ -142,7 +142,7 @@
 					requestorNodes[i] = pn.myRef;
 					requestorTimes[i] = now;
 					requestorBootIDs[i] = pn.getBootID();
-					if(x == ptr) break;
+					if(x == notIncluded) break;
 				}
 			}
 			return;
@@ -161,7 +161,7 @@
 			toIndex++;
 		}
 		
-		for(int fromIndex=0;fromIndex<ptr;fromIndex++) {
+		for(int fromIndex=0;fromIndex<notIncluded;fromIndex++) {
 			PeerNode pn = requestors[fromIndex];
 			if(pn != null) {
 				newRequestorNodes[toIndex] = pn.myRef;




More information about the cvs mailing list