staticIP should now work

(with resolved Conflict)

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1785 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
allo 2006-02-28 12:31:57 +00:00
parent 7c5f8f997a
commit 3b7e66ab48
3 changed files with 11 additions and 1 deletions

View File

@ -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);

View File

@ -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() {

View File

@ -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));