[freenet-cvs] r16898 - trunk/freenet/src/freenet/node/fcp

robert at freenetproject.org robert at freenetproject.org
Fri Jan 4 23:34:20 UTC 2008


Author: robert
Date: 2008-01-04 23:34:20 +0000 (Fri, 04 Jan 2008)
New Revision: 16898

Modified:
   trunk/freenet/src/freenet/node/fcp/FCPServer.java
Log:
don't get network port if disabled, lazy port-binding


Modified: trunk/freenet/src/freenet/node/fcp/FCPServer.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/FCPServer.java	2008-01-04 23:00:50 UTC (rev 16897)
+++ trunk/freenet/src/freenet/node/fcp/FCPServer.java	2008-01-04 23:34:20 UTC (rev 16898)
@@ -64,6 +64,7 @@
 	private static boolean ssl = false;
 	public final boolean enabled;
 	String bindTo;
+	private String allowedHosts;
 	AllowedHosts allowedHostsFullAccess;
 	final WeakHashMap clientsByName;
 	final FCPClient globalClient;
@@ -98,6 +99,7 @@
 
 	public FCPServer(String ipToBindTo, String allowedHosts, String allowedHostsFullAccess, int port, Node node, NodeClientCore core, boolean persistentDownloadsEnabled, String persistentDownloadsDir, long persistenceInterval, boolean isEnabled, boolean assumeDDADownloadAllowed, boolean assumeDDAUploadAllowed) throws IOException, InvalidConfigValueException {
 		this.bindTo = ipToBindTo;
+		this.allowedHosts=allowedHosts;
 		this.allowedHostsFullAccess = new AllowedHosts(allowedHostsFullAccess);
 		this.persistenceInterval = persistenceInterval;
 		this.port = port;
@@ -116,9 +118,14 @@
 		defaultFetchContext = client.getFetchContext();
 		defaultInsertContext = client.getInsertContext(false);
 		
-		
 		globalClient = new FCPClient("Global Queue", this, null, true);
 		
+		logMINOR = Logger.shouldLog(Logger.MINOR, this);
+	}
+	
+	private void maybeGetNetworkInterface() {
+		if (this.networkInterface!=null) return;
+		
 		NetworkInterface tempNetworkInterface = null;
 		try {
 			if(ssl) {
@@ -133,11 +140,11 @@
 		
 		this.networkInterface = tempNetworkInterface;
 		
-		logMINOR = Logger.shouldLog(Logger.MINOR, this);
 	}
 	
 	public void maybeStart() {
 		if (this.enabled) {
+			maybeGetNetworkInterface();
 			
 			if(enablePersistentDownloads) {
 				loadPersistentRequests();




More information about the cvs mailing list