Author: toad
Date: 2007-02-21 02:01:26 +0000 (Wed, 21 Feb 2007)
New Revision: 11871

Modified:
   trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
   trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
Log:
Fix another accounting bug

Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java 
2007-02-21 01:25:39 UTC (rev 11870)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java 
2007-02-21 02:01:26 UTC (rev 11871)
@@ -137,7 +137,7 @@
                return fatallyFailedBlocks;
        }

-       public synchronized void onSuccess(FetchResult result, int blockNo) {
+       public synchronized void onSuccess(FetchResult result, int blockNo, 
boolean dontNotify) {
                logMINOR = Logger.shouldLog(Logger.MINOR, this);
                if(isFinished()) return;
                if(blockNo < dataKeys.length) {
@@ -158,6 +158,7 @@
                } else
                        Logger.error(this, "Unrecognized block number: 
"+blockNo, new Exception("error"));
                fetchedBlocks++;
+               parentFetcher.parent.completedBlock(dontNotify);
                if(logMINOR) Logger.minor(this, "Fetched "+fetchedBlocks+" 
blocks");
                if(fetchedBlocks >= minFetched)
                        startDecode();

Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java      
2007-02-21 01:25:39 UTC (rev 11870)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java      
2007-02-21 02:01:26 UTC (rev 11871)
@@ -141,20 +141,20 @@
                Bucket data = extract(block, token);
                if(data == null) return; // failed
                if(!block.isMetadata()) {
-                       onSuccess(new FetchResult((ClientMetadata)null, data), 
token);
+                       onSuccess(new FetchResult((ClientMetadata)null, data), 
fromStore, token);
                } else {
                        onFailure(new 
FetchException(FetchException.INVALID_METADATA, "Metadata where expected 
data"), token);
                }
        }

        /** Will be overridden by SingleFileFetcher */
-       protected void onSuccess(FetchResult data, int blockNo) {
+       protected void onSuccess(FetchResult data, boolean fromStore, int 
blockNo) {
                if(parent.isCancelled()) {
                        data.asBucket().free();
                        onFailure(new FetchException(FetchException.CANCELLED), 
blockNo);
                        return;
                }
-               segment.onSuccess(data, blockNo);
+               segment.onSuccess(data, blockNo, fromStore);
        }

        /** Convert a ClientKeyBlock to a Bucket. If an error occurs, report it 
via onFailure


Reply via email to