Author: toad
Date: 2006-12-09 17:56:16 +0000 (Sat, 09 Dec 2006)
New Revision: 11319

Modified:
   trunk/freenet/src/freenet/client/HighLevelSimpleClient.java
   trunk/freenet/src/freenet/client/HighLevelSimpleClientImpl.java
   trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
   trunk/freenet/src/freenet/clients/http/Toadlet.java
Log:
Each fproxy GET started gets a separate clientContext, so they are 
round-robin'ed over.
(So that one large fproxy request doesn't block lots of them)

Modified: trunk/freenet/src/freenet/client/HighLevelSimpleClient.java
===================================================================
--- trunk/freenet/src/freenet/client/HighLevelSimpleClient.java 2006-12-09 
17:10:50 UTC (rev 11318)
+++ trunk/freenet/src/freenet/client/HighLevelSimpleClient.java 2006-12-09 
17:56:16 UTC (rev 11319)
@@ -32,6 +32,11 @@
        public FetchResult fetch(FreenetURI uri, long maxSize) throws 
FetchException;

        /**
+        * Blocking fetch of a URI with a configurable max-size and context 
object.
+        */
+       public FetchResult fetch(FreenetURI uri, long maxSize, Object context) 
throws FetchException;
+       
+       /**
         * Blocking insert.
         * @param filenameHint If set, insert a single-file manifest containing 
only this file, under the given filename.
         * @throws InserterException If there is an error inserting the data

Modified: trunk/freenet/src/freenet/client/HighLevelSimpleClientImpl.java
===================================================================
--- trunk/freenet/src/freenet/client/HighLevelSimpleClientImpl.java     
2006-12-09 17:10:50 UTC (rev 11318)
+++ trunk/freenet/src/freenet/client/HighLevelSimpleClientImpl.java     
2006-12-09 17:56:16 UTC (rev 11319)
@@ -117,14 +117,18 @@
        }

        public FetchResult fetch(FreenetURI uri, long overrideMaxSize) throws 
FetchException {
+               return fetch(uri, overrideMaxSize, this);
+       }
+
+       public FetchResult fetch(FreenetURI uri, long overrideMaxSize, Object 
clientContext) throws FetchException {
                if(uri == null) throw new NullPointerException();
+               FetchWaiter fw = new FetchWaiter();
                FetcherContext context = getFetcherContext(overrideMaxSize);
-               FetchWaiter fw = new FetchWaiter();
-               ClientGetter get = new ClientGetter(fw, 
core.requestStarters.chkFetchScheduler, core.requestStarters.sskFetchScheduler, 
uri, context, priorityClass, this, null);
+               ClientGetter get = new ClientGetter(fw, 
core.requestStarters.chkFetchScheduler, core.requestStarters.sskFetchScheduler, 
uri, context, priorityClass, clientContext, null);
                get.start();
                return fw.waitForCompletion();
        }
-
+       
        public FreenetURI insert(InsertBlock insert, boolean getCHKOnly, String 
filenameHint) throws InserterException {
                return insert(insert, getCHKOnly, filenameHint, false);
        }

Modified: trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/FProxyToadlet.java   2006-12-09 
17:10:50 UTC (rev 11318)
+++ trunk/freenet/src/freenet/clients/http/FProxyToadlet.java   2006-12-09 
17:56:16 UTC (rev 11319)
@@ -335,7 +335,7 @@
                try {
                        if(Logger.shouldLog(Logger.MINOR, this))
                                Logger.minor(this, "FProxy fetching "+key+" 
("+maxSize+ ')');
-                       FetchResult result = fetch(key, maxSize);
+                       FetchResult result = fetch(key, maxSize, httprequest /* 
fixme replace if HTTPRequest ever becomes comparable */); 

                        // Now, is it safe?


Modified: trunk/freenet/src/freenet/clients/http/Toadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/Toadlet.java 2006-12-09 17:10:50 UTC 
(rev 11318)
+++ trunk/freenet/src/freenet/clients/http/Toadlet.java 2006-12-09 17:56:16 UTC 
(rev 11319)
@@ -95,10 +95,13 @@
         * Client calls from the above messages to run a freenet request.
         * This method may block (or suspend).
         * @param maxSize Maximum length of returned content.
+        * @param clientContext Client context object. This should be the same 
for any group of related requests, but different
+        * for any two unrelated requests. Request selection round-robin's over 
these, within any priority and retry count class,
+        * and above the level of individual block fetches.
         */
-       FetchResult fetch(FreenetURI uri, long maxSize) throws FetchException {
+       FetchResult fetch(FreenetURI uri, long maxSize, Object clientContext) 
throws FetchException {
                // For now, just run it blocking.
-               return client.fetch(uri, maxSize);
+               return client.fetch(uri, maxSize, clientContext);
        }

        FreenetURI insert(InsertBlock insert, String filenameHint, boolean 
getCHKOnly) throws InserterException {


Reply via email to