Author: toad
Date: 2005-11-05 20:33:58 +0000 (Sat, 05 Nov 2005)
New Revision: 7479
Modified:
trunk/freenet/src/freenet/client/FetcherContext.java
trunk/freenet/src/freenet/client/Segment.java
Log:
Minor fix - don't remove final on FetcherContext, provide a standard-masks
constructor.
Modified: trunk/freenet/src/freenet/client/FetcherContext.java
===================================================================
--- trunk/freenet/src/freenet/client/FetcherContext.java 2005-11-05
20:33:28 UTC (rev 7478)
+++ trunk/freenet/src/freenet/client/FetcherContext.java 2005-11-05
20:33:58 UTC (rev 7479)
@@ -7,6 +7,7 @@
/** Context for a Fetcher. Contains all the settings a Fetcher needs to know
about. */
public class FetcherContext implements Cloneable {
+ public static final int SPLITFILE_DEFAULT_MASK = 1;
/** Low-level client to send low-level requests to. */
final SimpleLowLevelClient client;
final long maxOutputLength;
@@ -47,6 +48,26 @@
this.localRequestOnly = localRequestOnly;
}
+ public FetcherContext(FetcherContext ctx, int maskID) {
+ if(maskID == SPLITFILE_DEFAULT_MASK) {
+ this.client = ctx.client;
+ this.maxOutputLength = ctx.maxOutputLength;
+ this.maxTempLength = ctx.maxTempLength;
+ this.archiveManager = ctx.archiveManager;
+ this.bucketFactory = ctx.bucketFactory;
+ this.maxRecursionLevel = 0;
+ this.maxArchiveRestarts = 0;
+ this.dontEnterImplicitArchives = true;
+ this.random = ctx.random;
+ this.maxSplitfileThreads = 0;
+ this.maxSplitfileBlockRetries = 0;
+ this.maxNonSplitfileRetries =
ctx.maxNonSplitfileRetries;
+ this.allowSplitfiles = false;
+ this.followRedirects = false;
+ this.localRequestOnly = ctx.localRequestOnly;
+ } else throw new IllegalArgumentException();
+ }
+
/** Make public, but just call parent for a field for field copy */
public Object clone() {
try {
Modified: trunk/freenet/src/freenet/client/Segment.java
===================================================================
--- trunk/freenet/src/freenet/client/Segment.java 2005-11-05 20:33:28 UTC
(rev 7478)
+++ trunk/freenet/src/freenet/client/Segment.java 2005-11-05 20:33:58 UTC
(rev 7479)
@@ -222,9 +222,7 @@
minRetryLevel = 0;
this.recursionLevel = recursionLevel;
// FIXME be a bit more flexible here depending on flags
- blockFetchContext = (FetcherContext) fetcherContext.clone();
- blockFetchContext.allowSplitfiles = false;
- blockFetchContext.dontEnterImplicitArchives = true;
+ blockFetchContext = new FetcherContext(fetcherContext,
FetcherContext.SPLITFILE_DEFAULT_MASK);
}
/**