Author: toad
Date: 2007-05-25 23:51:55 +0000 (Fri, 25 May 2007)
New Revision: 13379

Modified:
   trunk/freenet/src/freenet/client/async/BinaryBlobInserter.java
   trunk/freenet/src/freenet/client/async/ClientGetter.java
   trunk/freenet/src/freenet/client/async/ClientPutter.java
   trunk/freenet/src/freenet/node/SimpleSendableInsert.java
Log:
Blocks should be stored, unless the global setting is for them not to be.
Other work on binary blob insertion.

Modified: trunk/freenet/src/freenet/client/async/BinaryBlobInserter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/BinaryBlobInserter.java      
2007-05-25 22:18:41 UTC (rev 13378)
+++ trunk/freenet/src/freenet/client/async/BinaryBlobInserter.java      
2007-05-25 23:51:55 UTC (rev 13379)
@@ -33,10 +33,12 @@
        private int completedBlocks;
        private int succeededBlocks;
        private boolean fatal;
+       final InsertContext ctx;

        BinaryBlobInserter(Bucket blob, ClientPutter parent, Object 
clientContext, boolean tolerant, short prioClass, InsertContext ctx) 
        throws IOException, BinaryBlobFormatException {
                logMINOR = Logger.shouldLog(Logger.MINOR, this);
+               this.ctx = ctx;
                this.maxRetries = ctx.maxInsertRetries;
                this.consecutiveRNFsCountAsSuccess = 
ctx.consecutiveRNFsCountAsSuccess;
                this.parent = parent;
@@ -235,6 +237,10 @@
                                parent.failedBlock();
                        maybeFinish();
                }
+               
+               boolean shouldCache() {
+                       return ctx.cacheLocalRequests;
+               }
        }

        public void maybeFinish() {

Modified: trunk/freenet/src/freenet/client/async/ClientGetter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/ClientGetter.java    2007-05-25 
22:18:41 UTC (rev 13378)
+++ trunk/freenet/src/freenet/client/async/ClientGetter.java    2007-05-25 
23:51:55 UTC (rev 13379)
@@ -14,6 +14,7 @@
 import freenet.client.FetchResult;
 import freenet.client.FetchContext;
 import freenet.client.events.SplitfileProgressEvent;
+import freenet.keys.ClientKeyBlock;
 import freenet.keys.FreenetURI;
 import freenet.keys.Key;
 import freenet.keys.KeyBlock;
@@ -240,8 +241,10 @@
                return super.toString()+ ':' +uri;
        }

-       void addKeyToBinaryBlob(KeyBlock block) {
+       void addKeyToBinaryBlob(ClientKeyBlock block) {
                if(binaryBlobKeysAddedAlready == null) return;
+               if(Logger.shouldLog(Logger.MINOR, this)) 
+                       Logger.minor(this, "Adding key 
"+block.getClientKey().getURI()+" to "+this, new Exception("debug"));
                Key key = block.getKey();
                synchronized(binaryBlobKeysAddedAlready) {
                        if(binaryBlobStream == null) return;

Modified: trunk/freenet/src/freenet/client/async/ClientPutter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/ClientPutter.java    2007-05-25 
22:18:41 UTC (rev 13378)
+++ trunk/freenet/src/freenet/client/async/ClientPutter.java    2007-05-25 
23:51:55 UTC (rev 13379)
@@ -203,6 +203,8 @@
        }

        public void cancel() {
+               if(Logger.shouldLog(Logger.MINOR, this))
+                       Logger.minor(this, "Cancelling "+this, new 
Exception("debug"));
                ClientPutState oldState = null;
                synchronized(this) {
                        if(cancelled) return;

Modified: trunk/freenet/src/freenet/node/SimpleSendableInsert.java
===================================================================
--- trunk/freenet/src/freenet/node/SimpleSendableInsert.java    2007-05-25 
22:18:41 UTC (rev 13378)
+++ trunk/freenet/src/freenet/node/SimpleSendableInsert.java    2007-05-25 
23:51:55 UTC (rev 13379)
@@ -110,4 +110,8 @@
                if(arr != null) arr.remove(this);
        }

+       boolean shouldCache() {
+               // This is only used as-is by the random reinsert from a 
request code. Subclasses should override!
+               return false;
+       }
 }


Reply via email to