Author: toad
Date: 2006-03-09 19:10:14 +0000 (Thu, 09 Mar 2006)
New Revision: 8203

Modified:
   trunk/freenet/src/freenet/client/FetcherContext.java
   trunk/freenet/src/freenet/client/async/SingleFileFetcher.java
   trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
   trunk/freenet/src/freenet/node/Version.java
   trunk/freenet/src/freenet/node/fcp/ClientGet.java
Log:
513:
Fix major feedback bug: we were not duplicating the SimpleEventProducer => we 
were getting the notification for any ClientGet on all ClientGet's!

Modified: trunk/freenet/src/freenet/client/FetcherContext.java
===================================================================
--- trunk/freenet/src/freenet/client/FetcherContext.java        2006-03-09 
18:54:21 UTC (rev 8202)
+++ trunk/freenet/src/freenet/client/FetcherContext.java        2006-03-09 
19:10:14 UTC (rev 8203)
@@ -1,6 +1,7 @@
 package freenet.client;

 import freenet.client.events.ClientEventProducer;
+import freenet.client.events.SimpleEventProducer;
 import freenet.crypt.RandomSource;
 import freenet.support.BucketFactory;

@@ -70,7 +71,11 @@
                this.cacheLocalRequests = cacheLocalRequests;
        }

-       public FetcherContext(FetcherContext ctx, int maskID) {
+       public FetcherContext(FetcherContext ctx, int maskID, boolean 
keepProducer) {
+               if(keepProducer)
+                       this.eventProducer = ctx.eventProducer;
+               else
+                       this.eventProducer = new SimpleEventProducer();
                if(maskID == IDENTICAL_MASK) {
                        this.maxOutputLength = ctx.maxOutputLength;
                        this.maxMetadataSize = ctx.maxMetadataSize;
@@ -88,7 +93,6 @@
                        this.followRedirects = ctx.followRedirects;
                        this.localRequestOnly = ctx.localRequestOnly;
                        this.splitfileUseLengths = ctx.splitfileUseLengths;
-                       this.eventProducer = ctx.eventProducer;
                        this.maxDataBlocksPerSegment = 
ctx.maxDataBlocksPerSegment;
                        this.maxCheckBlocksPerSegment = 
ctx.maxCheckBlocksPerSegment;
                        this.cacheLocalRequests = ctx.cacheLocalRequests;
@@ -110,7 +114,6 @@
                        this.followRedirects = false;
                        this.localRequestOnly = ctx.localRequestOnly;
                        this.splitfileUseLengths = false;
-                       this.eventProducer = ctx.eventProducer;
                        this.maxDataBlocksPerSegment = 0;
                        this.maxCheckBlocksPerSegment = 0;
                        this.cacheLocalRequests = ctx.cacheLocalRequests;
@@ -132,7 +135,6 @@
                        this.followRedirects = ctx.followRedirects;
                        this.localRequestOnly = ctx.localRequestOnly;
                        this.splitfileUseLengths = false;
-                       this.eventProducer = ctx.eventProducer;
                        this.maxDataBlocksPerSegment = 
ctx.maxDataBlocksPerSegment;
                        this.maxCheckBlocksPerSegment = 
ctx.maxCheckBlocksPerSegment;
                        this.cacheLocalRequests = ctx.cacheLocalRequests;
@@ -154,7 +156,6 @@
                        this.followRedirects = ctx.followRedirects;
                        this.localRequestOnly = ctx.localRequestOnly;
                        this.splitfileUseLengths = true;
-                       this.eventProducer = ctx.eventProducer;
                        this.maxDataBlocksPerSegment = 
ctx.maxDataBlocksPerSegment;
                        this.maxCheckBlocksPerSegment = 
ctx.maxCheckBlocksPerSegment;
                        this.cacheLocalRequests = ctx.cacheLocalRequests;
@@ -176,7 +177,6 @@
                        this.followRedirects = ctx.followRedirects;
                        this.localRequestOnly = ctx.localRequestOnly;
                        this.splitfileUseLengths = ctx.splitfileUseLengths;
-                       this.eventProducer = ctx.eventProducer;
                        this.maxDataBlocksPerSegment = 
ctx.maxDataBlocksPerSegment;
                        this.maxCheckBlocksPerSegment = 
ctx.maxCheckBlocksPerSegment;
                        this.cacheLocalRequests = ctx.cacheLocalRequests;

Modified: trunk/freenet/src/freenet/client/async/SingleFileFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SingleFileFetcher.java       
2006-03-09 18:54:21 UTC (rev 8202)
+++ trunk/freenet/src/freenet/client/async/SingleFileFetcher.java       
2006-03-09 19:10:14 UTC (rev 8203)
@@ -383,7 +383,7 @@
                Metadata newMeta = (Metadata) metadata.clone();
                newMeta.setSimpleRedirect();
                SingleFileFetcher f;
-               f = new SingleFileFetcher(this, newMeta, new 
ArchiveFetcherCallback(forData), new FetcherContext(ctx, 
FetcherContext.SET_RETURN_ARCHIVES));
+               f = new SingleFileFetcher(this, newMeta, new 
ArchiveFetcherCallback(forData), new FetcherContext(ctx, 
FetcherContext.SET_RETURN_ARCHIVES, true));
                f.handleMetadata();
                // When it is done (if successful), the ArchiveCallback will 
re-call this function.
                // Which will then discover that the metadata *is* available.

Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java 
2006-03-09 18:54:21 UTC (rev 8202)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java 
2006-03-09 19:10:14 UTC (rev 8203)
@@ -79,10 +79,10 @@
                this.fetcherContext = fetchContext;
                maxBlockLength = maxTempLength;
                if(splitUseLengths) {
-                       blockFetchContext = new FetcherContext(fetcherContext, 
FetcherContext.SPLITFILE_USE_LENGTHS_MASK);
+                       blockFetchContext = new FetcherContext(fetcherContext, 
FetcherContext.SPLITFILE_USE_LENGTHS_MASK, true);
                        this.recursionLevel = recursionLevel + 1;
                } else {
-                       blockFetchContext = new FetcherContext(fetcherContext, 
FetcherContext.SPLITFILE_DEFAULT_BLOCK_MASK);
+                       blockFetchContext = new FetcherContext(fetcherContext, 
FetcherContext.SPLITFILE_DEFAULT_BLOCK_MASK, true);
                        this.recursionLevel = 0;
                }
        }

Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2006-03-09 18:54:21 UTC (rev 
8202)
+++ trunk/freenet/src/freenet/node/Version.java 2006-03-09 19:10:14 UTC (rev 
8203)
@@ -20,7 +20,7 @@
        public static final String protocolVersion = "1.0";

        /** The build number of the current revision */
-       private static final int buildNumber = 512;
+       private static final int buildNumber = 513;

        /** Oldest build of Fred we will talk to */
        private static final int lastGoodBuild = 507;

Modified: trunk/freenet/src/freenet/node/fcp/ClientGet.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientGet.java   2006-03-09 18:54:21 UTC 
(rev 8202)
+++ trunk/freenet/src/freenet/node/fcp/ClientGet.java   2006-03-09 19:10:14 UTC 
(rev 8203)
@@ -91,7 +91,7 @@
                } else {
                        client = handler.getClient();
                }
-               fctx = new FetcherContext(client.defaultFetchContext, 
FetcherContext.IDENTICAL_MASK);
+               fctx = new FetcherContext(client.defaultFetchContext, 
FetcherContext.IDENTICAL_MASK, false);
                fctx.eventProducer.addEventListener(this);
                // ignoreDS
                fctx.localRequestOnly = message.dsOnly;
@@ -169,7 +169,7 @@
                boolean ignoreDS = Fields.stringToBool(fs.get("IgnoreDS"), 
false);
                boolean dsOnly = Fields.stringToBool(fs.get("DSOnly"), false);
                int maxRetries = Integer.parseInt(fs.get("MaxRetries"));
-               fctx = new FetcherContext(client.defaultFetchContext, 
FetcherContext.IDENTICAL_MASK);
+               fctx = new FetcherContext(client.defaultFetchContext, 
FetcherContext.IDENTICAL_MASK, false);
                fctx.eventProducer.addEventListener(this);
                // ignoreDS
                fctx.localRequestOnly = dsOnly;


Reply via email to