Author: toad
Date: 2009-04-10 14:52:07 +0000 (Fri, 10 Apr 2009)
New Revision: 26711

Modified:
   trunk/freenet/src/freenet/client/async/ClientGetter.java
Log:
If cancelling the client state doesn't call onFailure, we need to do it.


Modified: trunk/freenet/src/freenet/client/async/ClientGetter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/ClientGetter.java    2009-04-10 
14:40:38 UTC (rev 26710)
+++ trunk/freenet/src/freenet/client/async/ClientGetter.java    2009-04-10 
14:52:07 UTC (rev 26711)
@@ -259,6 +259,10 @@
                }
        }
 
+       /**
+        * Cancel the request. This must result in onFailure() being called in 
order to
+        * send the client a cancel FetchException, and to removeFrom() the 
state.
+        */
        public void cancel(ObjectContainer container, ClientContext context) {
                if(logMINOR) Logger.minor(this, "Cancelling "+this, new 
Exception("debug"));
                ClientGetState s;
@@ -281,6 +285,13 @@
                } else {
                        if(logMINOR) Logger.minor(this, "Nothing to cancel");
                }
+               ClientGetState state;
+               synchronized(this) {
+                       state = currentState;
+               }
+               if(state == null) return;
+               Logger.error(this, "Cancelling "+currentState+" did not call 
onFailure(), so did not removeFrom() or call callback");
+               this.onFailure(new FetchException(FetchException.CANCELLED), 
state, container, context);
        }
 
        @Override

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to