r26708 - trunk/freenet/src/freenet/client/async

[email protected]
Newsgroups gmane.network.freenet.cvs
Message-ID <[email protected]>
Author: toad
Date: 2009-04-10 13:39:00 +0000 (Fri, 10 Apr 2009)
New Revision: 26708

Modified:
   trunk/freenet/src/freenet/client/async/PersistentCooldownQueue.java
   trunk/freenet/src/freenet/client/async/PersistentCooldownQueueItem.java
Log:
Don't leak keys in cooldown queue!


Modified: trunk/freenet/src/freenet/client/async/PersistentCooldownQueue.java
===================================================================
--- trunk/freenet/src/freenet/client/async/PersistentCooldownQueue.java	2009-04-10 13:31:01 UTC (rev 26707)
+++ trunk/freenet/src/freenet/client/async/PersistentCooldownQueue.java	2009-04-10 13:39:00 UTC (rev 26708)
@@ -79,7 +79,7 @@
 		while(results.hasNext()) {
 			found = true;
 			PersistentCooldownQueueItem i = (PersistentCooldownQueueItem) results.next();
-			container.delete(i);
+			i.delete(container);
 		}
 		return found;
 	}

Modified: trunk/freenet/src/freenet/client/async/PersistentCooldownQueueItem.java
===================================================================
--- trunk/freenet/src/freenet/client/async/PersistentCooldownQueueItem.java	2009-04-10 13:31:01 UTC (rev 26707)
+++ trunk/freenet/src/freenet/client/async/PersistentCooldownQueueItem.java	2009-04-10 13:39:00 UTC (rev 26708)
@@ -3,6 +3,8 @@
  */
 package freenet.client.async;
 
+import com.db4o.ObjectContainer;
+
 import freenet.keys.Key;
 import freenet.node.SendableGet;
 import freenet.support.HexUtil;
@@ -23,4 +25,11 @@
 		this.time = time;
 		this.parent = parent;
 	}
+
+	public void delete(ObjectContainer container) {
+		// client not our problem.
+		// parent not our problem.
+		key.removeFrom(container);
+		container.delete(this);
+	}
 }
\ No newline at end of file
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.