Author: toad
Date: 2008-02-16 12:48:04 +0000 (Sat, 16 Feb 2008)
New Revision: 17986

Modified:
   trunk/freenet/src/freenet/client/async/RequestCooldownQueue.java
Log:
Logging, minor fix

Modified: trunk/freenet/src/freenet/client/async/RequestCooldownQueue.java
===================================================================
--- trunk/freenet/src/freenet/client/async/RequestCooldownQueue.java    
2008-02-16 12:30:21 UTC (rev 17985)
+++ trunk/freenet/src/freenet/client/async/RequestCooldownQueue.java    
2008-02-16 12:48:04 UTC (rev 17986)
@@ -109,17 +109,13 @@
        synchronized Key removeKeyBefore(long now) {
                logMINOR = Logger.shouldLog(Logger.MINOR, this);
                if(logMINOR)
-                       Logger.minor(this, "Remove key before "+now);
+                       Logger.minor(this, "Remove key before "+now+" : 
startPtr="+startPtr+" endPtr="+endPtr+" holes="+holes);
                while(true) {
                        if(startPtr == endPtr) {
                                if(logMINOR) Logger.minor(this, "No keys 
queued");
                                return null;
                        }
                        long time = times[startPtr];
-                       if(time > now) {
-                               if(logMINOR) Logger.minor(this, "First key is 
later at time "+time);
-                               return null;
-                       }
                        Key key = keys[startPtr];
                        if(key == null) {
                                times[startPtr] = 0;
@@ -129,10 +125,15 @@
                                if(logMINOR) Logger.minor(this, "Skipped hole");
                                continue;
                        } else {
+                               if(time > now) {
+                                       if(logMINOR) Logger.minor(this, "First 
key is later at time "+time);
+                                       return null;
+                               }
                                times[startPtr] = 0;
                                keys[startPtr] = null;
                                startPtr++;
                        }
+                       if(logMINOR) Logger.minor(this, "Returning key "+key);
                        return key;
                }
        }
@@ -142,7 +143,7 @@
         */
        synchronized boolean removeKey(Key key, long time) {
                logMINOR = Logger.shouldLog(Logger.MINOR, this);
-               if(logMINOR) Logger.minor(this, "Remove key "+key+" at time 
"+time);
+               if(logMINOR) Logger.minor(this, "Remove key "+key+" at time 
"+time+" startPtr="+startPtr+" endPtr="+endPtr+" holes="+holes);
                int idx = -1;
                if(endPtr > startPtr) {
                        idx = Fields.binarySearch(times, time, startPtr, 
endPtr);


Reply via email to