Author: toad
Date: 2009-04-08 16:10:40 +0000 (Wed, 08 Apr 2009)
New Revision: 26655

Modified:
   trunk/freenet/src/freenet/client/async/USKChecker.java
   trunk/freenet/src/freenet/client/async/USKFetcher.java
Log:
Use the polling priorities from USKs. This does boost the effective priority of 
ARK fetches to 2, so theoretically it might exacerbate problems with USK 
requests flooding ... but FMS fetches at prio 2 anyway...


Modified: trunk/freenet/src/freenet/client/async/USKChecker.java
===================================================================
--- trunk/freenet/src/freenet/client/async/USKChecker.java      2009-04-08 
15:09:21 UTC (rev 26654)
+++ trunk/freenet/src/freenet/client/async/USKChecker.java      2009-04-08 
16:10:40 UTC (rev 26655)
@@ -97,5 +97,10 @@
        public void onFailed(KeyListenerConstructionException e, 
ObjectContainer container, ClientContext context) {
                onFailure(new 
LowLevelGetException(LowLevelGetException.INTERNAL_ERROR, "IMPOSSIBLE: Failed 
to create Bloom filters (we don't have any!)", e), null, container, context);
        }
+       
+       @Override
+       public short getPriorityClass(ObjectContainer container) {
+               return cb.getPriority();
+       }
 
 }

Modified: trunk/freenet/src/freenet/client/async/USKFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/USKFetcher.java      2009-04-08 
15:09:21 UTC (rev 26654)
+++ trunk/freenet/src/freenet/client/async/USKFetcher.java      2009-04-08 
16:10:40 UTC (rev 26655)
@@ -66,6 +66,7 @@
  */
 public class USKFetcher implements ClientGetState {
     private static volatile boolean logMINOR;
+    private static volatile boolean logDEBUG;
 
     static {
         Logger.registerLogThresholdCallback(new LogThresholdCallback() {
@@ -73,6 +74,7 @@
             @Override
             public void shouldUpdate() {
                 logMINOR = Logger.shouldLog(Logger.MINOR, this);
+                logDEBUG = Logger.shouldLog(Logger.DEBUG, this);
             }
         });
     }
@@ -570,12 +572,17 @@
                for(int i=0;i<localCallbacks.length;i++) {
                        USKCallback cb = localCallbacks[i];
                        short prio = cb.getPollingPriorityNormal();
+                       if(logDEBUG) Logger.debug(this, "Normal priority for 
"+cb+" : "+prio);
                        if(prio < normalPrio) normalPrio = prio;
+                       if(logDEBUG) Logger.debug(this, "Progress priority for 
"+cb+" : "+prio);
                        prio = cb.getPollingPriorityProgress();
                        if(prio < progressPrio) progressPrio = prio;
                }
-               normalPollPriority = normalPrio;
-               progressPollPriority = progressPrio;
+               if(logMINOR) Logger.minor(this, "Updating priorities: 
normal="+normalPrio+" progress="+progressPrio+" for "+this+" for "+origUSK);
+               synchronized(this) {
+                       normalPollPriority = normalPrio;
+                       progressPollPriority = progressPrio;
+               }
        }
 
        public synchronized boolean hasSubscribers() {

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to