[freenet-cvs] r17140 - in trunk/freenet/src/freenet: clients/http node

2008-01-18 Thread [email protected]
Author: toad
Date: 2008-01-18 14:51:15 + (Fri, 18 Jan 2008)
New Revision: 17140

Added:
   trunk/freenet/src/freenet/clients/http/StartupToadlet.java
Removed:
   trunk/freenet/src/freenet/clients/http/StartupToadletServer.java
Modified:
   trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
   trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
   trunk/freenet/src/freenet/clients/http/StaticToadlet.java
   trunk/freenet/src/freenet/clients/http/ToadletContextImpl.java
   trunk/freenet/src/freenet/node/Node.java
   trunk/freenet/src/freenet/node/NodeClientCore.java
Log:
Use SimpleToadletServer during startup, not two different servers, one of which 
has to be killed and therefore frequently causes bind failures.
Initially it only has the static toadlet and the startup toadlet, we add the 
others later on.

Modified: trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
===
--- trunk/freenet/src/freenet/clients/http/FProxyToadlet.java   2008-01-18 
14:41:31 UTC (rev 17139)
+++ trunk/freenet/src/freenet/clients/http/FProxyToadlet.java   2008-01-18 
14:51:15 UTC (rev 17140)
@@ -595,16 +595,10 @@
return f;
}

-   public static SimpleToadletServer maybeCreateFProxyEtc(NodeClientCore 
core, Node node, Config config, SubConfig fproxyConfig) throws IOException, 
InvalidConfigValueException {
+   public static SimpleToadletServer maybeCreateFProxyEtc(NodeClientCore 
core, Node node, Config config, SubConfig fproxyConfig, SimpleToadletServer 
server) throws IOException, InvalidConfigValueException {

-   SimpleToadletServer server = null;
-   
// FIXME how to change these on the fly when the interface 
language is changed?

-   try {
-   
-   server = new SimpleToadletServer(fproxyConfig, core);
-   
HighLevelSimpleClient client = 
core.makeClient(RequestStarter.INTERACTIVE_PRIORITY_CLASS, true);

random = new byte[32];
@@ -625,9 +619,6 @@
ConfigToadlet configtoadlet = new ConfigToadlet(client, 
config, node, core);
server.register(configtoadlet, "/config/", true, 
"FProxyToadlet.configTitle", "FProxyToadlet.config", true, null);

-   StaticToadlet statictoadlet = new StaticToadlet(client);
-   server.register(statictoadlet, "/static/", true, false);
-   
SymlinkerToadlet symlinkToadlet = new 
SymlinkerToadlet(client, node);
server.register(symlinkToadlet, "/sl/", true, false);

@@ -666,13 +657,6 @@
FirstTimeWizardToadlet firstTimeWizardToadlet = new 
FirstTimeWizardToadlet(client, node, core);
server.register(firstTimeWizardToadlet, 
FirstTimeWizardToadlet.TOADLET_URL, true, false);

-   }catch (BindException e){
-   Logger.error(core,"Failed to start FProxy port already 
bound: isn't Freenet already running ?", e);
-   System.err.println("Failed to start FProxy port already 
bound: isn't Freenet already running ?");
-   throw new 
InvalidConfigValueException(l10n("cantBindPort"));
-   }catch (IOException ioe) {
-   Logger.error(core,"Failed to start FProxy: "+ioe, ioe);
-   }

fproxyConfig.finishedInitialization();


Modified: trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
===
--- trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java 
2008-01-18 14:41:31 UTC (rev 17139)
+++ trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java 
2008-01-18 14:51:15 UTC (rev 17140)
@@ -31,6 +31,7 @@
 import freenet.io.SSLNetworkInterface;
 import freenet.l10n.L10n;
 import freenet.node.NodeClientCore;
+import freenet.support.Executor;
 import freenet.support.HTMLNode;
 import freenet.support.Logger;
 import freenet.support.OOMHandler;
@@ -55,7 +56,7 @@
String bindTo;
private String allowedHosts;
final AllowedHosts allowedFullAccess;
-   final BucketFactory bf;
+   BucketFactory bf;
NetworkInterface networkInterface;
private final LinkedList toadlets;
private String cssName;
@@ -65,7 +66,8 @@
private boolean ssl = false;
private boolean fProxyJavascriptEnabled;
private final PageMaker pageMaker;
-   private final NodeClientCore core;
+   private NodeClientCore core;
+   private final Executor executor;
private boolean doRobots;

static boolean isPanicButtonToBeShown;
@@ -163,6 +165,7 @@
}

public void set(String val) throws InvalidConfigValueException {
+   if(cor

[freenet-cvs] r17140 - in trunk/freenet/src/freenet: clients/http node

2008-01-18 Thread toad
Author: toad
Date: 2008-01-18 14:51:15 + (Fri, 18 Jan 2008)
New Revision: 17140

Added:
   trunk/freenet/src/freenet/clients/http/StartupToadlet.java
Removed:
   trunk/freenet/src/freenet/clients/http/StartupToadletServer.java
Modified:
   trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
   trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
   trunk/freenet/src/freenet/clients/http/StaticToadlet.java
   trunk/freenet/src/freenet/clients/http/ToadletContextImpl.java
   trunk/freenet/src/freenet/node/Node.java
   trunk/freenet/src/freenet/node/NodeClientCore.java
Log:
Use SimpleToadletServer during startup, not two different servers, one of which 
has to be killed and therefore frequently causes bind failures.
Initially it only has the static toadlet and the startup toadlet, we add the 
others later on.

Modified: trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
===
--- trunk/freenet/src/freenet/clients/http/FProxyToadlet.java   2008-01-18 
14:41:31 UTC (rev 17139)
+++ trunk/freenet/src/freenet/clients/http/FProxyToadlet.java   2008-01-18 
14:51:15 UTC (rev 17140)
@@ -595,16 +595,10 @@
return f;
}
 
-   public static SimpleToadletServer maybeCreateFProxyEtc(NodeClientCore 
core, Node node, Config config, SubConfig fproxyConfig) throws IOException, 
InvalidConfigValueException {
+   public static SimpleToadletServer maybeCreateFProxyEtc(NodeClientCore 
core, Node node, Config config, SubConfig fproxyConfig, SimpleToadletServer 
server) throws IOException, InvalidConfigValueException {

-   SimpleToadletServer server = null;
-   
// FIXME how to change these on the fly when the interface 
language is changed?

-   try {
-   
-   server = new SimpleToadletServer(fproxyConfig, core);
-   
HighLevelSimpleClient client = 
core.makeClient(RequestStarter.INTERACTIVE_PRIORITY_CLASS, true);

random = new byte[32];
@@ -625,9 +619,6 @@
ConfigToadlet configtoadlet = new ConfigToadlet(client, 
config, node, core);
server.register(configtoadlet, "/config/", true, 
"FProxyToadlet.configTitle", "FProxyToadlet.config", true, null);

-   StaticToadlet statictoadlet = new StaticToadlet(client);
-   server.register(statictoadlet, "/static/", true, false);
-   
SymlinkerToadlet symlinkToadlet = new 
SymlinkerToadlet(client, node);
server.register(symlinkToadlet, "/sl/", true, false);

@@ -666,13 +657,6 @@
FirstTimeWizardToadlet firstTimeWizardToadlet = new 
FirstTimeWizardToadlet(client, node, core);
server.register(firstTimeWizardToadlet, 
FirstTimeWizardToadlet.TOADLET_URL, true, false);

-   }catch (BindException e){
-   Logger.error(core,"Failed to start FProxy port already 
bound: isn't Freenet already running ?", e);
-   System.err.println("Failed to start FProxy port already 
bound: isn't Freenet already running ?");
-   throw new 
InvalidConfigValueException(l10n("cantBindPort"));
-   }catch (IOException ioe) {
-   Logger.error(core,"Failed to start FProxy: "+ioe, ioe);
-   }

fproxyConfig.finishedInitialization();


Modified: trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
===
--- trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java 
2008-01-18 14:41:31 UTC (rev 17139)
+++ trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java 
2008-01-18 14:51:15 UTC (rev 17140)
@@ -31,6 +31,7 @@
 import freenet.io.SSLNetworkInterface;
 import freenet.l10n.L10n;
 import freenet.node.NodeClientCore;
+import freenet.support.Executor;
 import freenet.support.HTMLNode;
 import freenet.support.Logger;
 import freenet.support.OOMHandler;
@@ -55,7 +56,7 @@
String bindTo;
private String allowedHosts;
final AllowedHosts allowedFullAccess;
-   final BucketFactory bf;
+   BucketFactory bf;
NetworkInterface networkInterface;
private final LinkedList toadlets;
private String cssName;
@@ -65,7 +66,8 @@
private boolean ssl = false;
private boolean fProxyJavascriptEnabled;
private final PageMaker pageMaker;
-   private final NodeClientCore core;
+   private NodeClientCore core;
+   private final Executor executor;
private boolean doRobots;

static boolean isPan