Author: toad
Date: 2006-08-23 00:17:34 +0000 (Wed, 23 Aug 2006)
New Revision: 10242
Modified:
trunk/freenet/src/freenet/client/async/SplitFileInserterSegment.java
trunk/freenet/src/freenet/node/fcp/FCPServer.java
Log:
Maybe fix rare insert resume failures.
Modified: trunk/freenet/src/freenet/client/async/SplitFileInserterSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileInserterSegment.java
2006-08-22 23:02:46 UTC (rev 10241)
+++ trunk/freenet/src/freenet/client/async/SplitFileInserterSegment.java
2006-08-23 00:17:34 UTC (rev 10242)
@@ -120,6 +120,7 @@
if(blockFS == null) {
hasURIs = false;
encoded = false;
+ Logger.normal(this, "Clearing encoded
because block "+i+" of "+segNo+" missing");
continue;
}
tmp = blockFS.get("URI");
@@ -132,7 +133,6 @@
}
} else {
hasURIs = false;
- encoded = false;
}
boolean blockFinished =
Fields.stringToBool(blockFS.get("Finished"), false) && checkURIs[i] != null;
// Read data; only necessary if the block isn't
finished.
@@ -153,12 +153,14 @@
// Don't create fetcher yet; that happens in
start()
} else blocksCompleted++;
if(checkBlocks[i] == null && checkURIs[i] ==
null) {
+ Logger.normal(this, "Clearing encoded
because block "+i+" of "+segNo+" missing");
encoded = false;
}
checkFS.removeSubset(index);
}
splitfileAlgo = FECCodec.getCodec(splitfileAlgorithm,
dataBlockCount, checkBlocks.length);
} else {
+ Logger.normal(this, "Not encoded because no check
blocks");
encoded = false;
splitfileAlgo = FECCodec.getCodec(splitfileAlgorithm,
dataBlockCount);
int checkBlocksCount = splitfileAlgo.countCheckBlocks();
Modified: trunk/freenet/src/freenet/node/fcp/FCPServer.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/FCPServer.java 2006-08-22 23:02:46 UTC
(rev 10241)
+++ trunk/freenet/src/freenet/node/fcp/FCPServer.java 2006-08-23 00:17:34 UTC
(rev 10242)
@@ -694,12 +694,15 @@
public void finishStart() {
this.globalClient.finishStart();
- Iterator i = clientsByName.values().iterator();
- for(;i.hasNext();) {
- FCPClient client = (FCPClient) i.next();
- client.finishStart();
+ FCPClient[] clients;
+ synchronized(this) {
+ clients = (FCPClient[])
clientsByName.values().toArray(new FCPClient[clientsByName.size()]);
}
+ for(int i=0;i<clients.length;i++) {
+ clients[i].finishStart();
+ }
+
if(enablePersistentDownloads)
startPersister();
canStartPersister = true;