Author: toad
Date: 2008-03-21 15:55:10 +0000 (Fri, 21 Mar 2008)
New Revision: 18675

Modified:
   trunk/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
   trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
Log:
Detect adding to cooldown queue when already on it here too.

Modified: trunk/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/BaseSingleFileFetcher.java   
2008-03-21 15:51:10 UTC (rev 18674)
+++ trunk/freenet/src/freenet/client/async/BaseSingleFileFetcher.java   
2008-03-21 15:55:10 UTC (rev 18675)
@@ -68,6 +68,10 @@
                if((retryCount <= maxRetries) || (maxRetries == -1)) {
                        if(retryCount % ClientRequestScheduler.COOLDOWN_RETRIES 
== 0) {
                                // Add to cooldown queue. Don't reschedule yet.
+                               long now = System.currentTimeMillis();
+                               if(cooldownWakeupTime > now)
+                                       Logger.error(this, "Already on the 
cooldown queue for "+this, new Exception("error"));
+                               else
                                cooldownWakeupTime = sched.queueCooldown(key);
                                return true; // We will retry, just not yet. 
See requeueAfterCooldown(Key).
                        } else {

Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java 
2008-03-21 15:51:10 UTC (rev 18674)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java 
2008-03-21 15:55:10 UTC (rev 18675)
@@ -381,6 +381,10 @@
                                tries = ++dataRetries[blockNo];
                                if(tries > maxTries && maxTries >= 0) failed = 
true;
                                else if(tries % 
ClientRequestScheduler.COOLDOWN_RETRIES == 0) {
+                                       long now = System.currentTimeMillis();
+                                       if(dataCooldownTimes[blockNo] > now)
+                                               Logger.error(this, "Already on 
the cooldown queue! for "+this+" data block no "+blockNo, new 
Exception("error"));
+                                       else
                                        dataCooldownTimes[blockNo] = 
sched.queueCooldown(key);
                                        cooldown = true;
                                }
@@ -390,6 +394,10 @@
                                tries = ++checkRetries[checkNo];
                                if(tries > maxTries && maxTries >= 0) failed = 
true;
                                else if(tries % 
ClientRequestScheduler.COOLDOWN_RETRIES == 0) {
+                                       long now = System.currentTimeMillis();
+                                       if(checkCooldownTimes[blockNo] > now)
+                                               Logger.error(this, "Already on 
the cooldown queue! for "+this+" check block no "+blockNo, new 
Exception("error"));
+                                       else
                                        checkCooldownTimes[checkNo] = 
sched.queueCooldown(key);
                                        cooldown = true;
                                }


Reply via email to