|
|
@ -165,18 +165,18 @@ public class serverSwitch
|
|
|
|
(int) getConfigLong("server.maxTrackingHostCount", 100));
|
|
|
|
(int) getConfigLong("server.maxTrackingHostCount", 100));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* get my public IP, either set statically or figure out dynamic
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
public String myPublicIP() {
|
|
|
|
public String myPublicIP() {
|
|
|
|
// if a static IP was configured, we have to return it here ...
|
|
|
|
// if a static IP was configured, we have to return it here ...
|
|
|
|
final String staticIP = getConfig("staticIP", "");
|
|
|
|
final String staticIP = getConfig("staticIP", "");
|
|
|
|
if ( staticIP.length() > 0 ) {
|
|
|
|
if ( !"".equals(staticIP) ) return staticIP;
|
|
|
|
return staticIP;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// otherwise we return the real IP address of this host
|
|
|
|
// otherwise we return the real IP address of this host
|
|
|
|
final InetAddress pLIP = Domains.myPublicLocalIP();
|
|
|
|
final InetAddress pLIP = Domains.myPublicLocalIP();
|
|
|
|
if ( pLIP != null ) {
|
|
|
|
if ( pLIP != null ) return pLIP.getHostAddress();
|
|
|
|
return pLIP.getHostAddress();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -189,6 +189,10 @@ public class serverSwitch
|
|
|
|
return this.log;
|
|
|
|
return this.log;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* add whole map of key-value pairs to config
|
|
|
|
|
|
|
|
* @param otherConfigs
|
|
|
|
|
|
|
|
*/
|
|
|
|
public void setConfig(final Map<String, String> otherConfigs) {
|
|
|
|
public void setConfig(final Map<String, String> otherConfigs) {
|
|
|
|
final Iterator<Map.Entry<String, String>> i = otherConfigs.entrySet().iterator();
|
|
|
|
final Iterator<Map.Entry<String, String>> i = otherConfigs.entrySet().iterator();
|
|
|
|
Map.Entry<String, String> entry;
|
|
|
|
Map.Entry<String, String> entry;
|
|
|
@ -326,6 +330,9 @@ public class serverSwitch
|
|
|
|
return this.configProps.keySet().iterator();
|
|
|
|
return this.configProps.keySet().iterator();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* write the changes to permanent storage (File)
|
|
|
|
|
|
|
|
*/
|
|
|
|
private void saveConfig() {
|
|
|
|
private void saveConfig() {
|
|
|
|
ConcurrentMap<String, String> configPropsCopy = new ConcurrentHashMap<String, String>();
|
|
|
|
ConcurrentMap<String, String> configPropsCopy = new ConcurrentHashMap<String, String>();
|
|
|
|
configPropsCopy.putAll(this.configProps); // avoid concurrency problems
|
|
|
|
configPropsCopy.putAll(this.configProps); // avoid concurrency problems
|
|
|
|