Author: toad
Date: 2008-03-29 15:09:16 +0000 (Sat, 29 Mar 2008)
New Revision: 18824

Modified:
   trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java
Log:
Try all retry counts on the chosen priority.

Modified: trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java
===================================================================
--- trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java  
2008-03-29 13:26:01 UTC (rev 18823)
+++ trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java  
2008-03-29 15:09:16 UTC (rev 18824)
@@ -403,12 +403,13 @@
                }
                SortedVectorByNumber s = priorities[choosenPriorityClass];
                if(s != null){
-                       while(true) {
-                               SectoredRandomGrabArrayWithInt rga = 
(SectoredRandomGrabArrayWithInt) s.getFirst();
+                       for(int retryIndex=0;retryIndex<s.count();retryIndex++) 
{
+                               SectoredRandomGrabArrayWithInt rga = 
(SectoredRandomGrabArrayWithInt) s.getByIndex(retryIndex);
                                if(rga == null) {
                                        if(logMINOR) Logger.minor(this, "No 
retrycount's left");
                                        break;
                                }
+                       while(true) {
                                if(logMINOR)
                                        Logger.minor(this, "Got retry count 
tracker "+rga);
                                SendableRequest req = (SendableRequest) 
rga.removeRandom(starter);
@@ -421,7 +422,7 @@
                                }
                                if(req == null) {
                                        if(logMINOR) Logger.minor(this, "No 
requests, adjusted retrycount "+rga.getNumber()+" ("+rga+ ')');
-                                       break;
+                                       break; // Try next retry count.
                                } else if(req.getPriorityClass() != 
choosenPriorityClass) {
                                        // Reinsert it : shouldn't happen if we 
are calling reregisterAll,
                                        // maybe we should ask people to report 
that error if seen
@@ -439,7 +440,7 @@
                                                Logger.error(this, "Could not 
find client grabber for client "+req.getClient()+" from "+rga);
                                        }
                                        innerRegister(req);
-                                       continue;
+                                       continue; // Try the next one on this 
retry count.
                                }

                                RandomGrabArray altRGA = null;
@@ -492,6 +493,7 @@
                                if(logMINOR) Logger.minor(this, "removeFirst() 
returning "+req);
                                return req;
                        }
+                       }
                }
                if(logMINOR) Logger.minor(this, "No requests to run");
                return null;


Reply via email to