r26712 - trunk/freenet/src/freenet/client/async

[email protected]
Newsgroups gmane.network.freenet.cvs,gmane.spam.detected
Message-ID <[email protected]>
Author: toad
Date: 2009-04-10 14:55:35 +0000 (Fri, 10 Apr 2009)
New Revision: 26712

Modified:
   trunk/freenet/src/freenet/client/async/ClientGetState.java
   trunk/freenet/src/freenet/client/async/SimpleSingleFileFetcher.java
Log:
Call the onFailure, and document why in ClientGetState interface


Modified: trunk/freenet/src/freenet/client/async/ClientGetState.java
===================================================================
--- trunk/freenet/src/freenet/client/async/ClientGetState.java	2009-04-10 14:52:07 UTC (rev 26711)
+++ trunk/freenet/src/freenet/client/async/ClientGetState.java	2009-04-10 14:55:35 UTC (rev 26712)
@@ -13,6 +13,9 @@
 
 	public void schedule(ObjectContainer container, ClientContext context) throws KeyListenerConstructionException;
 
+	/** Cancel the request, and call onFailure() on the callback in order to tell 
+	 * downstream (ultimately the client) that cancel has succeeded, and to allow
+	 * it to call removeFrom() to avoid a database leak. */
 	public void cancel(ObjectContainer container, ClientContext context);
 
 	public long getToken();

Modified: trunk/freenet/src/freenet/client/async/SimpleSingleFileFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SimpleSingleFileFetcher.java	2009-04-10 14:52:07 UTC (rev 26711)
+++ trunk/freenet/src/freenet/client/async/SimpleSingleFileFetcher.java	2009-04-10 14:55:35 UTC (rev 26712)
@@ -182,5 +182,11 @@
 		super.removeFrom(container, context);
 		// rcb is definitely not our responsibility.
 	}
-
+	
+	public void cancel(ObjectContainer container, ClientContext context) {
+		super.cancel(container, context);
+		if(persistent) container.activate(rcb, 1);
+		rcb.onFailure(new FetchException(FetchException.CANCELLED), this, container, context);
+	}
+	
 }
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.