r26666 - trunk/freenet/src/freenet/client/async

[email protected]
Newsgroups gmane.network.freenet.cvs
Message-ID <[email protected]>
Author: toad
Date: 2009-04-08 22:57:59 +0000 (Wed, 08 Apr 2009)
New Revision: 26666

Modified:
   trunk/freenet/src/freenet/client/async/SplitFileFetcher.java
Log:
Activation paranoia


Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcher.java	2009-04-08 22:54:45 UTC (rev 26665)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcher.java	2009-04-08 22:57:59 UTC (rev 26666)
@@ -563,11 +563,17 @@
 	}
 
 	public void cancel(ObjectContainer container, ClientContext context) {
-		if(persistent)
+		boolean persist = persistent;
+		if(persist)
 			container.activate(this, 1);
 		for(int i=0;i<segments.length;i++) {
 			if(logMINOR)
 				Logger.minor(this, "Cancelling segment "+i);
+			if(segments == null && persist && !container.ext().isActive(this)) {
+				// FIXME is this normal? If so just reactivate.
+				Logger.error(this, "Deactivated mid-cancel on "+this, new Exception("error"));
+				container.activate(this, 1);
+			}
 			if(segments[i] == null) {
 				synchronized(this) {
 					if(finished) {
@@ -577,7 +583,7 @@
 					}
 				}
 			}
-			if(persistent)
+			if(persist)
 				container.activate(segments[i], 1);
 			segments[i].cancel(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.