* use IsDefault() to check explicitly set values

pull/373/head
hagen 9 years ago
parent 70f72a78f6
commit 7a0a45e9d2

@ -83,14 +83,14 @@ namespace i2p
LogPrint(eLogDebug, "FS: data directory: ", datadir); LogPrint(eLogDebug, "FS: data directory: ", datadir);
uint16_t port; i2p::config::GetOption("port", port); uint16_t port; i2p::config::GetOption("port", port);
if (port) if (!i2p::config::IsDefault("port"))
{ {
LogPrint(eLogInfo, "Daemon: accepting incoming connections at port ", port); LogPrint(eLogInfo, "Daemon: accepting incoming connections at port ", port);
i2p::context.UpdatePort (port); i2p::context.UpdatePort (port);
} }
std::string host; i2p::config::GetOption("host", host); std::string host; i2p::config::GetOption("host", host);
if (host != "0.0.0.0") if (!i2p::config::IsDefault("host"))
{ {
LogPrint(eLogInfo, "Daemon: setting address for incoming connections to ", host); LogPrint(eLogInfo, "Daemon: setting address for incoming connections to ", host);
i2p::context.UpdateAddress (boost::asio::ip::address::from_string (host)); i2p::context.UpdateAddress (boost::asio::ip::address::from_string (host));

@ -48,7 +48,7 @@ namespace i2p
if (!port) if (!port)
port = rand () % (30777 - 9111) + 9111; // I2P network ports range port = rand () % (30777 - 9111) + 9111; // I2P network ports range
std::string host; i2p::config::GetOption("host", host); std::string host; i2p::config::GetOption("host", host);
if (host == "0.0.0.0") if (i2p::config::IsDefault("host"))
host = "127.0.0.1"; // replace default address with safe value host = "127.0.0.1"; // replace default address with safe value
routerInfo.AddSSUAddress (host.c_str(), port, routerInfo.GetIdentHash ()); routerInfo.AddSSUAddress (host.c_str(), port, routerInfo.GetIdentHash ());
routerInfo.AddNTCPAddress (host.c_str(), port); routerInfo.AddNTCPAddress (host.c_str(), port);

Loading…
Cancel
Save