Author: toad
Date: 2008-06-13 17:14:28 +0000 (Fri, 13 Jun 2008)
New Revision: 20317

Modified:
   branches/db4o/freenet/src/freenet/client/HighLevelSimpleClientImpl.java
   branches/db4o/freenet/src/freenet/client/async/SingleBlockInserter.java
   
branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
Log:
Beginnings of sorting out...

Modified: 
branches/db4o/freenet/src/freenet/client/HighLevelSimpleClientImpl.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/HighLevelSimpleClientImpl.java     
2008-06-13 17:14:00 UTC (rev 20316)
+++ branches/db4o/freenet/src/freenet/client/HighLevelSimpleClientImpl.java     
2008-06-13 17:14:28 UTC (rev 20317)
@@ -203,7 +203,7 @@
        public InsertContext getInsertContext(boolean forceNonPersistent) {
                return new InsertContext(bucketFactory, forceNonPersistent ? 
bucketFactory : persistentBucketFactory,
                                forceNonPersistent ? new 
NullPersistentFileTracker() : persistentFileTracker,
-                               random, INSERT_RETRIES, 
CONSECUTIVE_RNFS_ASSUME_SUCCESS,
+                               INSERT_RETRIES, CONSECUTIVE_RNFS_ASSUME_SUCCESS,
                                SPLITFILE_INSERT_THREADS, 
SPLITFILE_BLOCKS_PER_SEGMENT, SPLITFILE_CHECK_BLOCKS_PER_SEGMENT, 
                                globalEventProducer, cacheLocalRequests, 
core.uskManager, core.getExecutor());
        }

Modified: 
branches/db4o/freenet/src/freenet/client/async/SingleBlockInserter.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/SingleBlockInserter.java     
2008-06-13 17:14:00 UTC (rev 20316)
+++ branches/db4o/freenet/src/freenet/client/async/SingleBlockInserter.java     
2008-06-13 17:14:28 UTC (rev 20317)
@@ -12,6 +12,7 @@
 import freenet.client.FailureCodeTracker;
 import freenet.client.InsertContext;
 import freenet.client.InsertException;
+import freenet.crypt.RandomSource;
 import freenet.keys.CHKEncodeException;
 import freenet.keys.ClientCHKBlock;
 import freenet.keys.ClientKey;
@@ -81,7 +82,7 @@
                logMINOR = Logger.shouldLog(Logger.MINOR, this);
        }

-       protected ClientKeyBlock innerEncode() throws InsertException {
+       protected ClientKeyBlock innerEncode(RandomSource random) throws 
InsertException {
                String uriType = uri.getKeyType();
                if(uriType.equals("CHK")) {
                        try {
@@ -96,7 +97,7 @@
                } else if(uriType.equals("SSK") || uriType.equals("KSK")) {
                        try {
                                InsertableClientSSK ik = 
InsertableClientSSK.create(uri);
-                               return ik.encode(sourceData, isMetadata, 
compressionCodec == -1, compressionCodec, sourceLength, ctx.random);
+                               return ik.encode(sourceData, isMetadata, 
compressionCodec == -1, compressionCodec, sourceLength, random);
                        } catch (MalformedURLException e) {
                                throw new 
InsertException(InsertException.INVALID_URI, e, null);
                        } catch (SSKEncodeException e) {
@@ -119,7 +120,7 @@
                                block = (ClientKeyBlock) 
refToClientKeyBlock.get();
                                if(block != null) return block;
                        }
-                       block = innerEncode();
+                       block = innerEncode(context.random);
                        refToClientKeyBlock = 
                                new SoftReference(block);
                        shouldSend = (resultingURI == null);

Modified: 
branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
===================================================================
--- 
branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java  
    2008-06-13 17:14:00 UTC (rev 20316)
+++ 
branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java  
    2008-06-13 17:14:28 UTC (rev 20317)
@@ -138,13 +138,13 @@
                }
        }

-       public boolean hasValidKeys(KeysFetchingLocally keys, ObjectContainer 
container) {
+       public boolean hasValidKeys(KeysFetchingLocally keys, ObjectContainer 
container, ClientContext context) {
                synchronized(segment) {
                        for(int i=0;i<10;i++) {
                                Object ret;
                                int x;
                                if(blockNums.isEmpty()) return false;
-                               x = ctx.random.nextInt(blockNums.size());
+                               x = context.random.nextInt(blockNums.size());
                                ret = (Integer) blockNums.get(x);
                                Key key = 
segment.getBlockNodeKey(((Integer)ret).intValue());
                                if(key == null) {


Reply via email to