Author: toad
Date: 2008-09-26 17:34:11 +0000 (Fri, 26 Sep 2008)
New Revision: 22846
Modified:
branches/db4o/freenet/src/freenet/client/async/SingleFileFetcher.java
branches/db4o/freenet/src/freenet/client/async/SplitFileFetcher.java
Log:
Fix some merging related bugs
Modified: branches/db4o/freenet/src/freenet/client/async/SingleFileFetcher.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/SingleFileFetcher.java
2008-09-26 16:35:23 UTC (rev 22845)
+++ branches/db4o/freenet/src/freenet/client/async/SingleFileFetcher.java
2008-09-26 17:34:11 UTC (rev 22846)
@@ -754,6 +754,8 @@
wasActive =
container.ext().isActive(SingleFileFetcher.this);
if(!wasActive)
container.activate(SingleFileFetcher.this, 1);
+ if(persistent)
+ container.activate(actx, 1);
ah.activateForExecution(container);
ah.extractPersistentOffThread(result.asBucket(), actx, element, callback,
container, context);
if(!wasActive)
Modified: branches/db4o/freenet/src/freenet/client/async/SplitFileFetcher.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/SplitFileFetcher.java
2008-09-26 16:35:23 UTC (rev 22845)
+++ branches/db4o/freenet/src/freenet/client/async/SplitFileFetcher.java
2008-09-26 17:34:11 UTC (rev 22846)
@@ -146,12 +146,20 @@
finalLength = overrideLength;
}
long eventualLength = Math.max(overrideLength,
metadata.uncompressedDataLength());
+ boolean wasActive = true;
+ if(persistent) {
+ wasActive = container.ext().isActive(cb);
+ if(!wasActive)
+ container.activate(cb, 1);
+ }
cb.onExpectedSize(eventualLength, container);
String mimeType = metadata.getMIMEType();
if(mimeType != null)
cb.onExpectedMIME(mimeType, container);
if(metadata.uncompressedDataLength() > 0)
cb.onFinalizedMetadata(container);
+ if(!wasActive)
+ container.deactivate(cb, 1);
if(eventualLength > 0 && newCtx.maxOutputLength > 0 &&
eventualLength > newCtx.maxOutputLength)
throw new FetchException(FetchException.TOO_BIG,
eventualLength, true, clientMetadata.getMIMEType());
@@ -558,11 +566,12 @@
new SplitFileFetcherKeyListener(this,
keyCount, main, alt, mainBloomFilterSizeBytes, mainBloomK, !cacheLocalRequests,
localSalt, segments.length, perSegmentBloomFilterSizeBytes, perSegmentK,
persistent, false);
} catch (IOException e) {
Logger.error(this, "Unable to read Bloom filter
for "+this+" attempting to reconstruct...", e);
- mainBloomFile.delete();
- altBloomFile.delete();
+ main.delete();
+ alt.delete();
try {
mainBloomFile =
context.fg.makeRandomFile();
altBloomFile =
context.fg.makeRandomFile();
+ container.set(this);
} catch (IOException e1) {
throw new
KeyListenerConstructionException(new
FetchException(FetchException.BUCKET_ERROR, "Unable to create Bloom filter
files in reconstruction", e1));
}