* Router: When removing a config setting, remove from context also

This commit is contained in:
zzz
2012-03-22 19:40:17 +00:00
parent e3da181cea
commit ca57b71266
2 changed files with 18 additions and 2 deletions

View File

@@ -345,6 +345,8 @@ public class Router implements RouterClock.ClockShiftListener {
*/
public void removeConfigSetting(String name) {
_config.remove(name);
// remove the backing default also
_context.removeProperty(name);
}
/**
@@ -1279,7 +1281,7 @@ public class Router implements RouterClock.ClockShiftListener {
if (value != null)
_config.put(name, value);
else
_config.remove(name);
removeConfigSetting(name);
return saveConfig();
}
@@ -1298,7 +1300,7 @@ public class Router implements RouterClock.ClockShiftListener {
_config.putAll(toAdd);
if (toRemove != null) {
for (String s : toRemove) {
_config.remove(s);
removeConfigSetting(s);
}
}
return saveConfig();

View File

@@ -113,12 +113,26 @@ public class RouterContext extends I2PAppContext {
/**
* Modify the configuration attributes of this context, changing
* one of the properties provided during the context construction.
*
* @param propName The name of the property.
* @param value The new value for the property.
* @since 0.8.4
* @deprecated Use Router.saveConfig()
*/
public void setProperty(String propName, String value) {
_overrideProps.setProperty(propName, value);
}
/**
* Remove a property provided during the context construction.
* Only for use by the router. Others use Router.saveConfig()
*
* @param propName The name of the property.
* @since 0.9
*/
void removeProperty(String propName) {
_overrideProps.remove(propName);
}
public void addPropertyCallback(I2PPropertyCallback callback) {