Author: toad
Date: 2006-01-27 21:19:05 +0000 (Fri, 27 Jan 2006)
New Revision: 7957

Modified:
   trunk/freenet/src/freenet/client/async/SingleFileFetcher.java
   trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
   trunk/freenet/src/freenet/node/Version.java
Log:
408:
Stop remaining fetches when a splitfile segment has started decoding.
They are not necessary; they were still on the queue.

Modified: trunk/freenet/src/freenet/client/async/SingleFileFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SingleFileFetcher.java       
2006-01-27 21:14:20 UTC (rev 7956)
+++ trunk/freenet/src/freenet/client/async/SingleFileFetcher.java       
2006-01-27 21:19:05 UTC (rev 7957)
@@ -491,7 +491,7 @@
                return token;
        }

-       public void cancel() {
+       public synchronized void cancel() {
                cancelled = true;
        }


Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java 
2006-01-27 21:14:20 UTC (rev 7956)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java 
2006-01-27 21:19:05 UTC (rev 7957)
@@ -39,7 +39,7 @@
        final boolean nonFullBlocksAllowed;
        /** Has the segment finished processing? Irreversible. */
        private boolean finished;
-       private boolean decoded;
+       private boolean startedDecode;
        /** Bucket to store the data retrieved, after it has been decoded */
        private Bucket decodedData;
        /** Fetch context for block fetches */
@@ -160,9 +160,13 @@

        private void startDecode() {
                synchronized(this) {
-                       if(decoded) return;
-                       decoded = true;
+                       if(startedDecode) return;
+                       startedDecode = true;
                }
+               for(int i=0;i<dataBlockStatus.length;i++)
+                       dataBlockStatus[i].cancel();
+               for(int i=0;i<checkBlockStatus.length;i++)
+                       checkBlockStatus[i].cancel();
                Runnable r = new Decoder();
                Thread t = new Thread(r, "Decoder for "+this);
                t.setDaemon(true);

Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2006-01-27 21:14:20 UTC (rev 
7956)
+++ trunk/freenet/src/freenet/node/Version.java 2006-01-27 21:19:05 UTC (rev 
7957)
@@ -20,7 +20,7 @@
        public static final String protocolVersion = "1.0";

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

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


Reply via email to