Author: toad
Date: 2007-02-21 21:43:19 +0000 (Wed, 21 Feb 2007)
New Revision: 11888

Modified:
   trunk/freenet/src/freenet/client/async/ClientGetter.java
   trunk/freenet/src/freenet/client/async/SingleFileFetcher.java
   trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
   trunk/freenet/src/freenet/support/RandomGrabArrayItem.java
Log:
Logging, and remove immediately rather than waiting for next time (prevents 
empty request slots).

Modified: trunk/freenet/src/freenet/client/async/ClientGetter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/ClientGetter.java    2007-02-21 
21:16:15 UTC (rev 11887)
+++ trunk/freenet/src/freenet/client/async/ClientGetter.java    2007-02-21 
21:43:19 UTC (rev 11888)
@@ -143,7 +143,7 @@
                        synchronized(this) {
                                finished = true;
                        }
-                       if(e.errorCodes.isOneCodeOnly())
+                       if(e.errorCodes != null && e.errorCodes.isOneCodeOnly())
                                e = new 
FetchException(e.errorCodes.getFirstCode(), e);
                        if(e.mode == FetchException.DATA_NOT_FOUND && 
super.successfulBlocks > 0)
                                e = new FetchException(e, 
FetchException.ALL_DATA_NOT_FOUND);

Modified: trunk/freenet/src/freenet/client/async/SingleFileFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SingleFileFetcher.java       
2007-02-21 21:16:15 UTC (rev 11887)
+++ trunk/freenet/src/freenet/client/async/SingleFileFetcher.java       
2007-02-21 21:43:19 UTC (rev 11888)
@@ -546,11 +546,6 @@
                                ctx.allowSplitfiles == false && 
ctx.followRedirects == false && 
                                returnBucket == null && key instanceof 
ClientKey)
                        return new SimpleSingleFileFetcher((ClientKey)key, 
maxRetries, ctx, requester, cb, isEssential, l);
-               else
-                       if(logMINOR) 
-                               Logger.minor(SingleFileFetcher.class, "Not 
creating SimpleSingleFileFetcher: cm="+clientMetadata+
-                                       " uri="+uri+" 
("+uri.getAllMetaStrings()+") ctx.allowSplitfiles="+ctx.allowSplitfiles+
-                                               
"ctx.followRedirects="+ctx.followRedirects+" returnBucket="+returnBucket+" 
key="+key, new Exception());
                if(key instanceof ClientKey)
                        return new SingleFileFetcher(requester, cb, 
clientMetadata, (ClientKey)key, uri.listMetaStrings(), uri, 0, ctx, actx, 
maxRetries, recursionLevel, dontTellClientGet, l, isEssential, returnBucket, 
isFinal);
                else {

Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java      
2007-02-21 21:16:15 UTC (rev 11887)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java      
2007-02-21 21:43:19 UTC (rev 11888)
@@ -205,7 +205,7 @@
        }

        public synchronized boolean canRemove() {
-               if(blockNums.isEmpty()) {
+               if(blockNums.size() < 2) {
                        if(Logger.shouldLog(Logger.MINOR, this))
                                Logger.minor(this, "Removing "+this+" in 
canRemove()");
                        segment.removeSeg(this);
@@ -229,11 +229,11 @@
                Integer i = new Integer(blockNo);
                synchronized(this) {
                        blockNums.add(i);
+                       if(dontSchedule) return;
                        if(blockNums.size() > 1) {
                                if(logMINOR) Logger.minor(this, "Other blocks 
queued, not scheduling: "+blockNums.size()+" : "+blockNums);
                                return;
                        }
-                       if(dontSchedule) return;
                }
                if(!dontSchedule) schedule();
        }

Modified: trunk/freenet/src/freenet/support/RandomGrabArrayItem.java
===================================================================
--- trunk/freenet/src/freenet/support/RandomGrabArrayItem.java  2007-02-21 
21:16:15 UTC (rev 11887)
+++ trunk/freenet/src/freenet/support/RandomGrabArrayItem.java  2007-02-21 
21:43:19 UTC (rev 11888)
@@ -8,9 +8,11 @@
         * because other queued blocks have been sufficient. */
        public boolean isCancelled();

-       /** Can this item be removed from the queue? 
+       /** Can this item be removed from the queue after it has been handled?
         * Called immediately after finding a request to remove.
-        * If returns false, the item will remain in the queue and may be 
chosen again. */
+        * If returns false, the item will remain in the queue and may be 
chosen again.
+        * Note that in the case of SendableGet's, this is called before 
choseKey(), so
+        * it needs to return true if there are less than two requests on this 
object. */
        public boolean canRemove();

 }


Reply via email to