From 3b7e66ab4843e67559496c05e4494589dbabba35 Mon Sep 17 00:00:00 2001 From: allo Date: Tue, 28 Feb 2006 12:31:57 +0000 Subject: [PATCH] staticIP should now work (with resolved Conflict) git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1785 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/SettingsAck_p.java | 5 +++++ source/de/anomic/server/serverCore.java | 5 +++++ source/de/anomic/yacy/yacyClient.java | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/htroot/SettingsAck_p.java b/htroot/SettingsAck_p.java index 894eae19a..2b0353484 100644 --- a/htroot/SettingsAck_p.java +++ b/htroot/SettingsAck_p.java @@ -336,6 +336,11 @@ public class SettingsAck_p { // check if peer name already exists String peerName = (String) post.get("peername"); String staticIP = (String)post.get("staticIP"); + if(staticIP.equals("")){ + serverCore.useStaticIP=false; + }else{ + serverCore.useStaticIP=true; + } env.setConfig("staticIP", staticIP); if (staticIP.length() > 0) yacyCore.seedDB.mySeed.put(yacySeed.IP, staticIP); yacySeed oldSeed = yacyCore.seedDB.lookupByName(peerName); diff --git a/source/de/anomic/server/serverCore.java b/source/de/anomic/server/serverCore.java index af3d6bc77..fa8628e18 100644 --- a/source/de/anomic/server/serverCore.java +++ b/source/de/anomic/server/serverCore.java @@ -94,6 +94,7 @@ public final class serverCore extends serverAbstractThread implements serverThre public boolean forceRestart = false; // specifies if the server should try to do a restart public static boolean portForwardingEnabled = false; + public static boolean useStaticIP = false; public static serverPortForwarding portForwarding = null; private ServerSocket socket; // listener @@ -353,12 +354,16 @@ public final class serverCore extends serverAbstractThread implements serverThre this.switchboard.setConfig("portForwardingEnabled", "false"); throw e; } + } else { serverCore.portForwardingEnabled = false; serverCore.portForwarding = null; yacyCore.seedDB.mySeed.put(yacySeed.IP,publicIP()); yacyCore.seedDB.mySeed.put(yacySeed.PORT,Integer.toString(serverCore.getPortNr(this.switchboard.getConfig("port", "8080")))); } + if(! this.switchboard.getConfig("staticIP", "").equals("")) + serverCore.useStaticIP=true; + } public GenericObjectPool.Config getPoolConfig() { diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.java index cf0a3a57d..384426319 100644 --- a/source/de/anomic/yacy/yacyClient.java +++ b/source/de/anomic/yacy/yacyClient.java @@ -163,7 +163,7 @@ public final class yacyClient { final yacySeed mySeedBkp = (yacySeed) yacyCore.seedDB.mySeed.clone(); // we overwrite our own IP number only, if we do not portForwarding - if (serverCore.portForwardingEnabled) { + if (serverCore.portForwardingEnabled || serverCore.useStaticIP) { yacyCore.seedDB.mySeed.put(yacySeed.IP, serverCore.publicIP()); } else { yacyCore.seedDB.mySeed.put(yacySeed.IP, (String) result.get(yacySeed.YOURIP));