forked from I2P_Developers/i2p.i2p
- NTCP Port must now be either auto or configured;
now defaults to auto; and configured now trumps auto. Port configuration now does not affect whether inbound NTCP is enabled - the host configuration alone can do that.
This commit is contained in:
@ -66,8 +66,6 @@ public class ConfigNetHandler extends FormHandler {
|
||||
}
|
||||
public void setNtcpAutoPort(String mode) {
|
||||
_ntcpAutoPort = mode.equals("2");
|
||||
if (mode.equals("0"))
|
||||
_ntcpInboundDisabled = true;
|
||||
}
|
||||
public void setUpnp(String moo) { _upnp = true; }
|
||||
|
||||
@ -155,19 +153,14 @@ public class ConfigNetHandler extends FormHandler {
|
||||
restartRequired = true;
|
||||
}
|
||||
if (oldAutoPort != _ntcpAutoPort || ! oldNPort.equals(_ntcpPort)) {
|
||||
if ( _ntcpAutoPort ) {
|
||||
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_PORT, "true");
|
||||
_context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_PORT);
|
||||
addFormNotice("Updating inbound TCP port to auto");
|
||||
} else if (_ntcpPort.length() > 0) {
|
||||
if (_ntcpPort.length() > 0 && !_ntcpAutoPort) {
|
||||
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_PORT, _ntcpPort);
|
||||
_context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_PORT);
|
||||
addFormNotice("Updating inbound TCP port to " + _ntcpPort);
|
||||
} else {
|
||||
_context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_PORT);
|
||||
_context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_PORT);
|
||||
addFormNotice("Disabling inbound TCP");
|
||||
addFormNotice("Updating inbound TCP port to auto");
|
||||
}
|
||||
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_PORT, "" + _ntcpAutoPort);
|
||||
restartRequired = true;
|
||||
}
|
||||
|
||||
|
@ -103,10 +103,8 @@ public class ConfigNetHelper extends HelperBase {
|
||||
return DISABLED;
|
||||
String port = _context.getProperty(PROP_I2NP_NTCP_PORT);
|
||||
boolean specified = port != null && port.length() > 0;
|
||||
boolean auto = Boolean.valueOf(_context.getProperty(PROP_I2NP_NTCP_AUTO_PORT)).booleanValue();
|
||||
if ((mode == 0 && (!specified) && !auto) ||
|
||||
(mode == 1 && specified && !auto) ||
|
||||
(mode == 2 && auto))
|
||||
if ((mode == 1 && specified) ||
|
||||
(mode == 2 && !specified))
|
||||
return CHECKED;
|
||||
return "";
|
||||
}
|
||||
|
Reference in New Issue
Block a user