[freenet-cvs] r17485 - trunk/freenet/src/freenet/client/async

toad at freenetproject.org toad at freenetproject.org
Sat Feb 2 23:08:40 UTC 2008


Author: toad
Date: 2008-02-02 23:08:40 +0000 (Sat, 02 Feb 2008)
New Revision: 17485

Modified:
   trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java
   trunk/freenet/src/freenet/client/async/OfferedKeysList.java
Log:
Remove also in removePendingKey().

Modified: trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java
===================================================================
--- trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java	2008-02-02 23:05:43 UTC (rev 17484)
+++ trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java	2008-02-02 23:08:40 UTC (rev 17485)
@@ -474,6 +474,7 @@
 	}
 	
 	public void removePendingKey(SendableGet getter, boolean complain, Key key) {
+		boolean dropped = false;
 		synchronized(pendingKeys) {
 			Object o = pendingKeys.get(key);
 			if(o == null) {
@@ -510,6 +511,7 @@
 				}
 				if(newGets.length == 0) {
 					pendingKeys.remove(key);
+					dropped = true;
 				} else if(newGets.length == 1) {
 					pendingKeys.put(key, newGets[0]);
 				} else {
@@ -517,6 +519,10 @@
 				}
 			}
 		}
+		if(dropped && offeredKeys != null) {
+			for(int i=0;i<offeredKeys.length;i++)
+				offeredKeys[i].remove(key);
+		}
 	}
 	
 	/**
@@ -574,7 +580,7 @@
 	public void tripPendingKey(final KeyBlock block) {
 		if(offeredKeys != null) {
 			for(int i=0;i<offeredKeys.length;i++) {
-				offeredKeys[i].onFoundKey(block.getKey());
+				offeredKeys[i].remove(block.getKey());
 			}
 		}
 		final Key key = block.getKey();

Modified: trunk/freenet/src/freenet/client/async/OfferedKeysList.java
===================================================================
--- trunk/freenet/src/freenet/client/async/OfferedKeysList.java	2008-02-02 23:05:43 UTC (rev 17484)
+++ trunk/freenet/src/freenet/client/async/OfferedKeysList.java	2008-02-02 23:08:40 UTC (rev 17485)
@@ -51,8 +51,8 @@
 		logMINOR = Logger.shouldLog(Logger.MINOR, this);
 	}
 	
-	/** Called when a key is found */
-	public synchronized void onFoundKey(Key key) {
+	/** Called when a key is found, when it no longer belogns to this list etc. */
+	public synchronized void remove(Key key) {
 		logMINOR = Logger.shouldLog(Logger.MINOR, this);
 		ClientKey ck = (ClientKey) clientKeysByKey.remove(key);
 		if(ck == null) return;




More information about the cvs mailing list