Author: toad
Date: 2005-11-25 18:36:39 +0000 (Fri, 25 Nov 2005)
New Revision: 7605

Modified:
   trunk/freenet/src/freenet/client/HighLevelSimpleClientImpl.java
   trunk/freenet/src/freenet/client/RetryTracker.java
   trunk/freenet/src/freenet/client/SplitFetcher.java
   trunk/freenet/src/freenet/node/Version.java
Log:
224:
Up splitfile request threads to 20.
Fix some minor splitfile bugs.

Modified: trunk/freenet/src/freenet/client/HighLevelSimpleClientImpl.java
===================================================================
--- trunk/freenet/src/freenet/client/HighLevelSimpleClientImpl.java     
2005-11-25 18:12:03 UTC (rev 7604)
+++ trunk/freenet/src/freenet/client/HighLevelSimpleClientImpl.java     
2005-11-25 18:36:39 UTC (rev 7605)
@@ -30,7 +30,7 @@
        static final int MAX_ARCHIVE_RESTARTS = 2;
        static final boolean DONT_ENTER_IMPLICIT_ARCHIVES = true;
        /** Number of threads used by a splitfile fetch */
-       static final int SPLITFILE_THREADS = 10;
+       static final int SPLITFILE_THREADS = 20;
        /** Number of retries allowed per block in a splitfile. Must be at 
least 1 as 
         * on the first try we just check the datastore.
         */

Modified: trunk/freenet/src/freenet/client/RetryTracker.java
===================================================================
--- trunk/freenet/src/freenet/client/RetryTracker.java  2005-11-25 18:12:03 UTC 
(rev 7604)
+++ trunk/freenet/src/freenet/client/RetryTracker.java  2005-11-25 18:36:39 UTC 
(rev 7605)
@@ -174,8 +174,6 @@
         * we have run out of retries.
         */
        public void nonfatalError(SplitfileBlock block, int reasonCode) {
-               if(callOnProgress)
-                       callback.onProgress();
                synchronized(this) {
                        nonfatalErrors.inc(reasonCode);
                        runningBlocks.remove(block);
@@ -191,6 +189,8 @@
                        }
                        maybeStart(false);
                }
+               if(callOnProgress)
+                       callback.onProgress();
        }

        /**
@@ -199,14 +199,14 @@
         * @param reasonCode A client-specific code indicating the type of 
failure.
         */
        public void fatalError(SplitfileBlock block, int reasonCode) {
-               if(callOnProgress)
-                       callback.onProgress();
                synchronized(this) {
                        fatalErrors.inc(reasonCode);
                        runningBlocks.remove(block);
                        failedBlocksFatalErrors.add(block);
                        maybeStart(false);
                }
+               if(callOnProgress)
+                       callback.onProgress();
        }

        /**
@@ -217,7 +217,8 @@
                if(killed) return;
                Logger.minor(this, "succeeded: "+succeededBlocks.size()+", 
target: "+targetSuccesses+
                                ", failed: 
"+failedBlocksTooManyRetries.size()+", fatal: "+failedBlocksFatalErrors.size()+
-                               ", running: "+runningBlocks.size()+", levels: 
"+levels.size()+"("+curMinLevel+"-"+curMaxLevel+"), finishOnEmpty: 
"+finishOnEmpty);
+                               ", running: "+runningBlocks.size()+", levels: 
"+levels.size()+"("+curMinLevel+"-"+curMaxLevel+
+                               "), finishOnEmpty: "+finishOnEmpty+" for 
"+callback);
                if(runningBlocks.size() == 1)
                        Logger.minor(this, "Only block running: 
"+runningBlocks.toArray()[0]);
                else if(levels.isEmpty()) {
@@ -233,6 +234,7 @@
                        for(int i=0;i<running.length;i++) {
                                running[i].kill();
                        }
+                       runningBlocks.clear();
                        if(!cantCallFinished)
                                callback.finished(succeededBlocks(), 
failedBlocks(), fatalErrorBlocks());
                        else {
@@ -253,14 +255,14 @@
        }

        public void success(SplitfileBlock block) {
-               if(callOnProgress)
-                       callback.onProgress();
                synchronized(this) {
                        if(killed) return;
                        runningBlocks.remove(block);
                        succeededBlocks.add(block);
                        maybeStart(false);
                }
+               if(callOnProgress)
+                       callback.onProgress();
        }

        public synchronized void callOnProgress() {

Modified: trunk/freenet/src/freenet/client/SplitFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/SplitFetcher.java  2005-11-25 18:12:03 UTC 
(rev 7604)
+++ trunk/freenet/src/freenet/client/SplitFetcher.java  2005-11-25 18:36:39 UTC 
(rev 7605)
@@ -240,6 +240,8 @@
                int fatallyFailedBlocks = 0;
                int runningBlocks = 0;
                for(int i=0;i<segments.length;i++) {
+                       Logger.minor(this, "Segment: "+segments[i]+": 
fetched="+segments[i].fetchedBlocks()+", failedBlocks: 
"+segments[i].failedBlocks()+
+                                       ", fatally: 
"+segments[i].fatallyFailedBlocks()+", running: "+segments[i].runningBlocks());
                        fetchedBlocks += segments[i].fetchedBlocks();
                        failedBlocks += segments[i].failedBlocks();
                        fatallyFailedBlocks += 
segments[i].fatallyFailedBlocks();

Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2005-11-25 18:12:03 UTC (rev 
7604)
+++ trunk/freenet/src/freenet/node/Version.java 2005-11-25 18:36:39 UTC (rev 
7605)
@@ -20,7 +20,7 @@
        public static final String protocolVersion = "1.0";

        /** The build number of the current revision */
-       public static final int buildNumber = 223;
+       public static final int buildNumber = 224;

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


Reply via email to