Author: toad
Date: 2008-03-29 16:18:06 +0000 (Sat, 29 Mar 2008)
New Revision: 18831

Modified:
   trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
   trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
Log:
Always notify, even if from datastore, once scheduled.

Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java 
2008-03-29 16:16:11 UTC (rev 18830)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java 
2008-03-29 16:18:06 UTC (rev 18831)
@@ -66,6 +66,7 @@
        private int fetchedBlocks;
        final FailureCodeTracker errors;
        private boolean finishing;
+       private boolean scheduled;

        private FECCodec codec;

@@ -150,13 +151,14 @@
                return fatallyFailedBlocks;
        }

-       public void onSuccess(Bucket data, int blockNo, boolean dontNotify, 
SplitFileFetcherSubSegment seg, ClientKeyBlock block) {
+       public void onSuccess(Bucket data, int blockNo, 
SplitFileFetcherSubSegment seg, ClientKeyBlock block) {
                boolean decodeNow = false;
                logMINOR = Logger.shouldLog(Logger.MINOR, this);
                if(logMINOR) Logger.minor(this, "Fetched block "+blockNo+" on 
"+seg);
                if(parentFetcher.parent instanceof ClientGetter)
                        
((ClientGetter)parentFetcher.parent).addKeyToBinaryBlob(block);
                // No need to unregister key, because it will be cleared in 
tripPendingKey().
+               boolean dontNotify;
                synchronized(this) {
                        if(isFinished()) return;
                        if(blockNo < dataKeys.length) {
@@ -187,6 +189,7 @@
                                        finishing = true;
                                }
                        }
+                       dontNotify = !scheduled;
                }
                parentFetcher.parent.completedBlock(dontNotify);
                seg.possiblyRemoveFromParent();
@@ -478,6 +481,9 @@
                                seg.add(i, true);

                        seg.schedule();
+                       synchronized(this) {
+                               scheduled = true;
+                       }
                        parentFetcher.parent.notifyClients();
                        if(logMINOR)
                                Logger.minor(this, "scheduling "+seg+" : 
"+seg.blockNums);

Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java      
2008-03-29 16:16:11 UTC (rev 18830)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java      
2008-03-29 16:18:06 UTC (rev 18831)
@@ -252,7 +252,7 @@
                        onFailure(new FetchException(FetchException.CANCELLED), 
token, sched);
                        return;
                }
-               segment.onSuccess(data, blockNo, fromStore, this, block);
+               segment.onSuccess(data, blockNo, this, block);
        }

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


Reply via email to