Author: toad
Date: 2008-06-14 15:10:41 +0000 (Sat, 14 Jun 2008)
New Revision: 20347
Modified:
branches/db4o/freenet/src/freenet/node/Node.java
branches/db4o/freenet/src/freenet/node/NodeClientCore.java
branches/db4o/freenet/src/freenet/node/fcp/FCPServer.java
Log:
Pass in container in construction (we can safely access the db during the
creation phase)
Modified: branches/db4o/freenet/src/freenet/node/Node.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/Node.java 2008-06-14 14:32:03 UTC
(rev 20346)
+++ branches/db4o/freenet/src/freenet/node/Node.java 2008-06-14 15:10:41 UTC
(rev 20347)
@@ -1575,7 +1575,7 @@
nodeStats = new NodeStats(this, sortOrder, new
SubConfig("node.load", config), oldThrottleFS, obwLimit, ibwLimit, nodeDir);
- clientCore = new NodeClientCore(this, config, nodeConfig,
nodeDir, getDarknetPortNumber(), sortOrder, oldThrottleFS == null ? null :
oldThrottleFS.subset("RequestStarters"), oldConfig, fproxyConfig, toadlets);
+ clientCore = new NodeClientCore(this, config, nodeConfig,
nodeDir, getDarknetPortNumber(), sortOrder, oldThrottleFS == null ? null :
oldThrottleFS.subset("RequestStarters"), oldConfig, fproxyConfig, toadlets, db);
netid = new NetworkIDManager(this);
Modified: branches/db4o/freenet/src/freenet/node/NodeClientCore.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/NodeClientCore.java 2008-06-14
14:32:03 UTC (rev 20346)
+++ branches/db4o/freenet/src/freenet/node/NodeClientCore.java 2008-06-14
15:10:41 UTC (rev 20347)
@@ -141,7 +141,7 @@
private UserAlert startingUpAlert;
- NodeClientCore(Node node, Config config, SubConfig nodeConfig, File
nodeDir, int portNumber, int sortOrder, SimpleFieldSet oldThrottleFS,
SimpleFieldSet oldConfig, SubConfig fproxyConfig, SimpleToadletServer toadlets)
throws NodeInitException {
+ NodeClientCore(Node node, Config config, SubConfig nodeConfig, File
nodeDir, int portNumber, int sortOrder, SimpleFieldSet oldThrottleFS,
SimpleFieldSet oldConfig, SubConfig fproxyConfig, SimpleToadletServer toadlets,
ObjectContainer container) throws NodeInitException {
this.node = node;
this.nodeStats = node.nodeStats;
this.random = node.random;
@@ -347,7 +347,7 @@
// FCP (including persistent requests so needs to start before
FProxy)
try {
- fcpServer = FCPServer.maybeCreate(node, this,
node.config);
+ fcpServer = FCPServer.maybeCreate(node, this,
node.config, container);
} catch (IOException e) {
throw new
NodeInitException(NodeInitException.EXIT_COULD_NOT_START_FCP, "Could not start
FCP: "+e);
} catch (InvalidConfigValueException e) {
Modified: branches/db4o/freenet/src/freenet/node/fcp/FCPServer.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/fcp/FCPServer.java 2008-06-14
14:32:03 UTC (rev 20346)
+++ branches/db4o/freenet/src/freenet/node/fcp/FCPServer.java 2008-06-14
15:10:41 UTC (rev 20347)
@@ -646,10 +646,10 @@
private void innerMakePersistentGlobalRequest(FreenetURI fetchURI,
boolean persistRebootOnly, short returnType, String id, File returnFilename,
File returnTempFilename) throws
IdentifierCollisionException, NotAllowedException {
ClientGet cg =
- new ClientGet(globalClient, fetchURI,
defaultFetchContext.localRequestOnly,
+ new ClientGet(persistRebootOnly ? globalRebootClient :
globalForeverClient, fetchURI, defaultFetchContext.localRequestOnly,
defaultFetchContext.ignoreStore,
QUEUE_MAX_RETRIES, QUEUE_MAX_RETRIES,
QUEUE_MAX_DATA_SIZE, returnType,
persistRebootOnly, id, Integer.MAX_VALUE,
-
RequestStarter.BULK_SPLITFILE_PRIORITY_CLASS, returnFilename,
returnTempFilename);
+
RequestStarter.BULK_SPLITFILE_PRIORITY_CLASS, returnFilename,
returnTempFilename, this);
// Register before starting, because it may complete
immediately, and if it does,
// we may end up with it not being removable because it wasn't
registered!
if(cg.isPersistentForever())
@@ -662,7 +662,7 @@
* some time to start them.
*/
public void finishStart() {
- this.globalClient.finishStart();
+ this.globalForeverClient.finishStart();
FCPClient[] clients;
synchronized(this) {
@@ -673,9 +673,6 @@
clients[i].finishStart();
}
- if(enablePersistentDownloads)
- startPersister();
- canStartPersister = true;
hasFinishedStart = true;
}
@@ -685,9 +682,16 @@
*
* @return The global FCP client
*/
- public FCPClient getGlobalClient() {
- return globalClient;
+ public FCPClient getGlobalForeverClient() {
+ return globalForeverClient;
}
+
+ public ClientRequest getGlobalRequest(String identifier) {
+ ClientRequest req = globalRebootClient.getRequest(identifier);
+ if(req == null)
+ req = globalForeverClient.getRequest(identifier);
+ return req;
+ }
protected boolean isDownloadDDAAlwaysAllowed() {
return assumeDownloadDDAIsAllowed;
@@ -702,8 +706,10 @@
}
public void setCompletionCallback(RequestCompletionCallback cb) {
- if(globalClient.setRequestCompletionCallback(cb) != null)
+ if(globalForeverClient.setRequestCompletionCallback(cb) != null)
Logger.error(this, "Replacing request completion
callback "+cb, new Exception("error"));
+ if(globalRebootClient.setRequestCompletionCallback(cb) != null)
+ Logger.error(this, "Replacing request completion
callback "+cb, new Exception("error"));
}
}