I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 61525783 authored by zzz's avatar zzz
Browse files

* Transport: Fix NTCP address generation when host is specified but port is auto

parent 36a032d2
No related branches found
No related tags found
No related merge requests found
...@@ -316,6 +316,7 @@ public class CommSystemFacadeImpl extends CommSystemFacade { ...@@ -316,6 +316,7 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
String ohost = newProps.getProperty(NTCPAddress.PROP_HOST); String ohost = newProps.getProperty(NTCPAddress.PROP_HOST);
String enabled = _context.getProperty(PROP_I2NP_NTCP_AUTO_IP, "true"); String enabled = _context.getProperty(PROP_I2NP_NTCP_AUTO_IP, "true");
String name = _context.getProperty(PROP_I2NP_NTCP_HOSTNAME); String name = _context.getProperty(PROP_I2NP_NTCP_HOSTNAME);
// hostname config trumps auto config
if (name != null && name.length() > 0) if (name != null && name.length() > 0)
enabled = "false"; enabled = "false";
Transport udp = _manager.getTransport(UDPTransport.STYLE); Transport udp = _manager.getTransport(UDPTransport.STYLE);
...@@ -335,6 +336,17 @@ public class CommSystemFacadeImpl extends CommSystemFacade { ...@@ -335,6 +336,17 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
newProps.setProperty(NTCPAddress.PROP_HOST, nhost); newProps.setProperty(NTCPAddress.PROP_HOST, nhost);
changed = true; changed = true;
} }
} else if (enabled.equalsIgnoreCase("false") &&
name != null && name.length() > 0 &&
!name.equals(ohost) &&
nport != null) {
// Host name is configured, and we have a port (either auto or configured)
// but we probably only get here if the port is auto,
// otherwise createNTCPAddress() would have done it already
if (_log.shouldLog(Log.INFO))
_log.info("old: " + ohost + " config: " + name + " new: " + name);
newProps.setProperty(NTCPAddress.PROP_HOST, name);
changed = true;
} else if (ohost == null || ohost.length() <= 0) { } else if (ohost == null || ohost.length() <= 0) {
return; return;
} else if (enabled.equalsIgnoreCase("true") && status != STATUS_OK) { } else if (enabled.equalsIgnoreCase("true") && status != STATUS_OK) {
...@@ -359,10 +371,10 @@ public class CommSystemFacadeImpl extends CommSystemFacade { ...@@ -359,10 +371,10 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
if (_log.shouldLog(Log.WARN)) if (_log.shouldLog(Log.WARN))
_log.warn("Changing NTCP cost from " + oldCost + " to " + newCost); _log.warn("Changing NTCP cost from " + oldCost + " to " + newCost);
} else { } else {
_log.warn("No change to NTCP Address"); _log.info("No change to NTCP Address");
} }
} else { } else {
_log.warn("No change to NTCP Address"); _log.info("No change to NTCP Address");
} }
return; return;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment