- i2np.ntcp.autoip=true redefined to enable inbound only if

SSU reachability is OK. i2np.ntcp.autoip=always for the old behavior.
  autoip default is now "true".
  i2np.ntcp.hostname=xxx now trumps i2np.tcp.autoip.
- SSU always tells NTCP when status changes.
This commit is contained in:
zzz
2009-04-30 21:03:00 +00:00
parent 5b44bcb44f
commit b21e011203
5 changed files with 49 additions and 32 deletions

View File

@ -269,6 +269,8 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
}
boolean changed = false;
// Auto Port Setting
// old behavior (<= 0.7.3): auto-port defaults to false, and true trumps explicit setting
// new behavior (>= 0.7.4): auto-port defaults to true, but explicit setting trumps auto
String oport = newProps.getProperty(NTCPAddress.PROP_PORT);
@ -288,9 +290,26 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
changed = true;
}
// Auto IP Setting
// old behavior (<= 0.7.3): auto-ip defaults to false, and trumps configured hostname,
// and ignores reachability status - leading to
// "firewalled with inbound TCP enabled" warnings.
// new behavior (>= 0.7.4): auto-ip defaults to true, and explicit setting trumps auto,
// and only takes effect if reachability is OK.
// And new "always" setting ignores reachability status, like
// "true" was in 0.7.3
String ohost = newProps.getProperty(NTCPAddress.PROP_HOST);
if (Boolean.valueOf(_context.getProperty(PROP_I2NP_NTCP_AUTO_IP)).booleanValue()) {
String enabled = _context.getProperty(PROP_I2NP_NTCP_AUTO_IP, "true");
String name = _context.getProperty(PROP_I2NP_NTCP_HOSTNAME);
if (name != null && name.length() > 0)
enabled = "false";
if (_log.shouldLog(Log.INFO))
_log.info("old: " + ohost + " config: " + name + " auto: " + enabled + " status: " + getReachabilityStatus());
if (enabled.equalsIgnoreCase("always") ||
(enabled.equalsIgnoreCase("true") && getReachabilityStatus() == CommSystemFacade.STATUS_OK)) {
String nhost = UDPProps.getProperty(UDPAddress.PROP_HOST);
if (_log.shouldLog(Log.INFO))
_log.info("old: " + ohost + " config: " + name + " new: " + nhost);
if (nhost == null || nhost.length() <= 0)
return;
if (ohost == null || ! ohost.equalsIgnoreCase(nhost)) {

View File

@ -2102,7 +2102,10 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
if ( (status != old) && (status != CommSystemFacade.STATUS_UNKNOWN) ) {
if (_log.shouldLog(Log.INFO))
_log.info("Old status: " + old + " New status: " + status + " from: ", new Exception("traceback"));
if (needsRebuild())
// Always rebuild when the status changes, even if our address hasn't changed,
// as rebuildExternalAddress() calls replaceAddress() which calls CSFI.notifyReplaceAddress()
// which will start up NTCP inbound when we transition to OK.
// if (needsRebuild())
rebuildExternalAddress();
}
}