Author: toad
Date: 2007-05-03 20:53:48 +0000 (Thu, 03 May 2007)
New Revision: 13130

Modified:
   trunk/freenet/src/freenet/client/async/SimpleSingleFileFetcher.java
   trunk/freenet/src/freenet/client/async/SingleFileFetcher.java
Log:
Don't add block, essential or not, when following multi-level metadata or 
fetching an archive.
That will happen after we've handled the new metadata.

Modified: trunk/freenet/src/freenet/client/async/SimpleSingleFileFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SimpleSingleFileFetcher.java 
2007-05-03 20:47:52 UTC (rev 13129)
+++ trunk/freenet/src/freenet/client/async/SimpleSingleFileFetcher.java 
2007-05-03 20:53:48 UTC (rev 13130)
@@ -24,13 +24,15 @@
 public class SimpleSingleFileFetcher extends BaseSingleFileFetcher implements 
ClientGetState {

        SimpleSingleFileFetcher(ClientKey key, int maxRetries, FetchContext 
ctx, ClientRequester parent, 
-                       GetCompletionCallback rcb, boolean isEssential, long l) 
{
+                       GetCompletionCallback rcb, boolean isEssential, boolean 
dontAdd, long l) {
                super(key, maxRetries, ctx, parent);
                this.rcb = rcb;
                this.token = l;
-               parent.addBlock();
-               if(isEssential)
-                       parent.addMustSucceedBlocks(1);
+               if(!dontAdd) {
+                       parent.addBlock();
+                       if(isEssential)
+                               parent.addMustSucceedBlocks(1);
+               }
        }

        final GetCompletionCallback rcb;

Modified: trunk/freenet/src/freenet/client/async/SingleFileFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SingleFileFetcher.java       
2007-05-03 20:47:52 UTC (rev 13129)
+++ trunk/freenet/src/freenet/client/async/SingleFileFetcher.java       
2007-05-03 20:53:48 UTC (rev 13130)
@@ -64,7 +64,7 @@
                        ArchiveContext actx, ArchiveStoreContext ah, int 
maxRetries, int recursionLevel,
                        boolean dontTellClientGet, long l, boolean isEssential,
                        Bucket returnBucket, boolean isFinal) throws 
FetchException {
-               super(key, maxRetries, ctx, parent, cb, isEssential, l);
+               super(key, maxRetries, ctx, parent, cb, isEssential, false, l);
                logMINOR = Logger.shouldLog(Logger.MINOR, this);
                if(logMINOR) Logger.minor(this, "Creating SingleFileFetcher for 
"+key+" from "+origURI+" meta="+metaStrings.toString(), new Exception("debug"));
                this.isFinal = isFinal;
@@ -91,7 +91,7 @@
         * Used for things like slave fetchers for MultiLevelMetadata, 
therefore does not remember returnBucket,
         * metaStrings etc. */
        public SingleFileFetcher(SingleFileFetcher fetcher, Metadata newMeta, 
GetCompletionCallback callback, FetchContext ctx2) throws FetchException {
-               super(fetcher.key, fetcher.maxRetries, ctx2, fetcher.parent, 
callback, false, fetcher.token);
+               super(fetcher.key, fetcher.maxRetries, ctx2, fetcher.parent, 
callback, false, true, fetcher.token);
                logMINOR = Logger.shouldLog(Logger.MINOR, this);
                if(logMINOR) Logger.minor(this, "Creating SingleFileFetcher for 
"+fetcher.key+" meta="+fetcher.metaStrings.toString(), new Exception("debug"));
                this.returnBucket = null;
@@ -552,7 +552,7 @@
                if((clientMetadata == null || clientMetadata.isTrivial()) && 
(!uri.hasMetaStrings()) &&
                                ctx.allowSplitfiles == false && 
ctx.followRedirects == false && 
                                returnBucket == null && key instanceof 
ClientKey)
-                       return new SimpleSingleFileFetcher((ClientKey)key, 
maxRetries, ctx, requester, cb, isEssential, l);
+                       return new SimpleSingleFileFetcher((ClientKey)key, 
maxRetries, ctx, requester, cb, isEssential, false, l);
                if(key instanceof ClientKey)
                        return new SingleFileFetcher(requester, cb, 
clientMetadata, (ClientKey)key, uri.listMetaStrings(), uri, 0, ctx, actx, null, 
maxRetries, recursionLevel, dontTellClientGet, l, isEssential, returnBucket, 
isFinal);
                else {


Reply via email to