r27216 - trunk/freenet/src/freenet/clients/http

[email protected] Thu, 23 Apr 2009 01:18:07 +0000
Newsgroups gmane.network.freenet.cvs
Message-ID <[email protected]>
Author: toad
Date: 2009-04-23 01:18:06 +0000 (Thu, 23 Apr 2009)
New Revision: 27216

Modified:
   trunk/freenet/src/freenet/clients/http/FProxyFetchInProgress.java
Log:
Fail once per request. This is the best that can be done without having explicit session IDs for downloads in progress.


Modified: trunk/freenet/src/freenet/clients/http/FProxyFetchInProgress.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/FProxyFetchInProgress.java	2009-04-22 15:43:42 UTC (rev 27215)
+++ trunk/freenet/src/freenet/clients/http/FProxyFetchInProgress.java	2009-04-23 01:18:06 UTC (rev 27216)
@@ -84,6 +84,7 @@
 	/** Fetch failed */
 	private FetchException failed;
 	private boolean hasWaited;
+	private boolean hasNotifiedFailure;
 	/** Last time the fetch was accessed from the fproxy end */
 	private long lastTouched;
 	final FProxyFetchTracker tracker;
@@ -114,9 +115,10 @@
 		FProxyFetchResult res;
 		if(data != null)
 			res = new FProxyFetchResult(this, data, mimeType, timeStarted, goneToNetwork, getETA(), hasWaited);
-		else
+		else {
 			res = new FProxyFetchResult(this, mimeType, size, timeStarted, goneToNetwork,
 					totalBlocks, requiredBlocks, fetchedBlocks, failedBlocks, fatallyFailedBlocks, finalizedBlocks, failed, getETA(), hasWaited);
+		}
 		results.add(res);
 		return res;
 	}
@@ -287,6 +289,14 @@
 	public synchronized boolean notFinishedOrFatallyFinished() {
 		if(data == null && failed == null) return true;
 		if(failed != null && failed.isFatal()) return true;
+		if(failed != null && !hasNotifiedFailure) {
+			hasNotifiedFailure = true;
+			return true;
+		}
 		return false;
 	}
+	
+	public synchronized boolean hasNotifiedFailure() {
+		return true;
+	}
 }