Author: toad
Date: 2007-03-20 00:46:42 +0000 (Tue, 20 Mar 2007)
New Revision: 12230
Modified:
trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
trunk/freenet/src/freenet/io/NetworkInterface.java
Log:
Don't keep a separate copy of allowedHosts as a string
Modified: trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
2007-03-20 00:04:49 UTC (rev 12229)
+++ trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
2007-03-20 00:46:42 UTC (rev 12230)
@@ -52,7 +52,6 @@
final int port;
String bindTo;
- String allowedHosts;
final AllowedHosts allowedFullAccess;
final BucketFactory bf;
final NetworkInterface networkInterface;
@@ -101,13 +100,12 @@
class FProxyAllowedHostsCallback implements StringCallback {
public String get() {
- return allowedHosts;
+ return networkInterface.getAllowedHosts();
}
public void set(String allowedHosts) {
if (!allowedHosts.equals(get())) {
networkInterface.setAllowedHosts(allowedHosts);
- SimpleToadletServer.this.allowedHosts =
allowedHosts;
}
}
@@ -286,7 +284,6 @@
this.bf = core.tempBucketFactory;
port = fproxyConfig.getInt("port");
bindTo = fproxyConfig.getString("bindTo");
- allowedHosts = fproxyConfig.getString("allowedHosts");
cssName = fproxyConfig.getString("css");
if((cssName.indexOf(':') != -1) || (cssName.indexOf('/') != -1))
throw new InvalidConfigValueException("CSS name must
not contain slashes or colons!");
@@ -296,7 +293,7 @@
toadlets = new LinkedList();
core.setToadletContainer(this); // even if not enabled, because
of config
- this.networkInterface = new NetworkInterface(port, this.bindTo,
this.allowedHosts);
+ this.networkInterface = new NetworkInterface(port, this.bindTo,
fproxyConfig.getString("allowedHosts"));
if(!enabled) {
Logger.normal(core, "Not starting FProxy as it's
disabled");
System.out.println("Not starting FProxy as it's
disabled");
@@ -309,10 +306,9 @@
public SimpleToadletServer(int i, String newbindTo, String
allowedHosts, BucketFactory bf, String cssName, NodeClientCore core) throws
IOException {
this.port = i;
this.bindTo = newbindTo;
- this.allowedHosts = allowedHosts;
allowedFullAccess = new AllowedHosts(allowedHosts);
this.bf = bf;
- this.networkInterface = new NetworkInterface(port, this.bindTo,
this.allowedHosts);
+ this.networkInterface = new NetworkInterface(port, this.bindTo,
allowedHosts);
toadlets = new LinkedList();
this.cssName = cssName;
pageMaker = new PageMaker(cssName);
Modified: trunk/freenet/src/freenet/io/NetworkInterface.java
===================================================================
--- trunk/freenet/src/freenet/io/NetworkInterface.java 2007-03-20 00:04:49 UTC
(rev 12229)
+++ trunk/freenet/src/freenet/io/NetworkInterface.java 2007-03-20 00:46:42 UTC
(rev 12230)
@@ -301,4 +301,8 @@
}
+ public String getAllowedHosts() {
+ return allowedHosts.getAllowedHosts();
+ }
+
}