Author: toad
Date: 2008-06-26 21:52:13 +0000 (Thu, 26 Jun 2008)
New Revision: 20787

Modified:
   branches/db4o/freenet/src/freenet/client/async/ChosenRequest.java
   branches/db4o/freenet/src/freenet/node/SendableGet.java
Log:
Put the context from the FetchContext that is used by SendableGet.send() into 
ChosenRequest.

Modified: branches/db4o/freenet/src/freenet/client/async/ChosenRequest.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/ChosenRequest.java   
2008-06-26 21:43:41 UTC (rev 20786)
+++ branches/db4o/freenet/src/freenet/client/async/ChosenRequest.java   
2008-06-26 21:52:13 UTC (rev 20787)
@@ -3,10 +3,12 @@
  * http://www.gnu.org/ for further details of the GPL. */
 package freenet.client.async;

+import freenet.client.FetchContext;
 import freenet.keys.ClientKey;
 import freenet.keys.Key;
 import freenet.node.NodeClientCore;
 import freenet.node.RequestScheduler;
+import freenet.node.SendableGet;
 import freenet.node.SendableRequest;

 /**
@@ -26,6 +28,9 @@
        public final ClientKey ckey;
        /** Priority when we selected it */
        public short prio;
+       public final boolean localRequestOnly;
+       public final boolean cacheLocalRequests;
+       public final boolean ignoreStore;

        ChosenRequest(SendableRequest req, Object tok, Key key, ClientKey ckey, 
short prio) {
                request = req;
@@ -33,6 +38,17 @@
                this.key = key;
                this.ckey = ckey;
                this.prio = prio;
+               if(req instanceof SendableGet) {
+                       SendableGet sg = (SendableGet) req;
+                       FetchContext ctx = sg.getContext();
+                       localRequestOnly = ctx.localRequestOnly;
+                       cacheLocalRequests = ctx.cacheLocalRequests;
+                       ignoreStore = ctx.ignoreStore;
+               } else {
+                       localRequestOnly = false;
+                       cacheLocalRequests = false;
+                       ignoreStore = false;
+               }
        }

        public boolean send(NodeClientCore core, RequestScheduler sched) {

Modified: branches/db4o/freenet/src/freenet/node/SendableGet.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/SendableGet.java     2008-06-26 
21:43:41 UTC (rev 20786)
+++ branches/db4o/freenet/src/freenet/node/SendableGet.java     2008-06-26 
21:52:13 UTC (rev 20787)
@@ -71,7 +71,6 @@
                }
                if(Logger.shouldLog(Logger.MINOR, this))
                        Logger.minor(this, "Sending get for key "+keyNum+" : 
"+key);
-               FetchContext ctx = getContext();
                boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
                if((!req.isPersistent()) && isCancelled(null)) {
                        if(logMINOR) Logger.minor(this, "Cancelled: "+this);
@@ -81,7 +80,7 @@
                }
                try {
                        try {
-                               core.realGetKey(key, ctx.localRequestOnly, 
ctx.cacheLocalRequests, ctx.ignoreStore);
+                               core.realGetKey(key, req.localRequestOnly, 
req.cacheLocalRequests, req.ignoreStore);
                        } catch (final LowLevelGetException e) {
                                sched.callFailure(this, e, keyNum, 
NativeThread.HIGH_PRIORITY, req);
                                return true;


Reply via email to