Author: toad
Date: 2007-02-20 17:27:11 +0000 (Tue, 20 Feb 2007)
New Revision: 11849

Modified:
   trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
Log:
Fix max retries = -1.
Logging.

Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java 
2007-02-20 17:08:09 UTC (rev 11848)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java 
2007-02-20 17:27:11 UTC (rev 11849)
@@ -271,6 +271,7 @@
        /** This is after any retries and therefore is either out-of-retries or 
fatal */
        public synchronized void onFatalFailure(FetchException e, int blockNo) {
                logMINOR = Logger.shouldLog(Logger.MINOR, this);
+               if(logMINOR) Logger.minor(this, "Permanently failed block: 
"+blockNo+" on "+this+" : "+e, e);
                synchronized(this) {
                        if(blockNo < dataKeys.length) {
                                if(dataKeys[blockNo] == null) {
@@ -288,7 +289,6 @@
                        } else
                                Logger.error(this, "Unrecognized block number: 
"+blockNo, new Exception("error"));
                        // :(
-                       if(logMINOR) Logger.minor(this, "Permanently failed 
block: "+blockNo+" on "+this);
                        if(e.isFatal())
                                fatallyFailedBlocks++;
                        else
@@ -303,16 +303,17 @@
        public void onNonFatalFailure(FetchException e, int blockNo) {
                int tries;
                synchronized(this) {
+                       int maxTries = blockFetchContext.maxNonSplitfileRetries;
                        if(blockNo < dataKeys.length) {
                                tries = dataRetries[blockNo]++;
-                               if(dataRetries[blockNo] > 
blockFetchContext.maxNonSplitfileRetries) {
+                               if(dataRetries[blockNo] > maxTries && maxTries 
>= 0) {
                                        onFatalFailure(e, blockNo);
                                        return;
                                }
                        } else {
                                blockNo -= dataKeys.length;
                                tries = checkRetries[blockNo]++;
-                               if(checkRetries[blockNo] > 
blockFetchContext.maxNonSplitfileRetries) {
+                               if(checkRetries[blockNo] > maxTries && maxTries 
>= 0) {
                                        onFatalFailure(e, blockNo);
                                        return;
                                }


Reply via email to