diff --git a/Daemon.cpp b/Daemon.cpp index b9d8bd44..7421cba6 100644 --- a/Daemon.cpp +++ b/Daemon.cpp @@ -83,14 +83,14 @@ namespace i2p LogPrint(eLogDebug, "FS: data directory: ", datadir); uint16_t port; i2p::config::GetOption("port", port); - if (port) + if (!i2p::config::IsDefault("port")) { LogPrint(eLogInfo, "Daemon: accepting incoming connections at port ", port); i2p::context.UpdatePort (port); } 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); i2p::context.UpdateAddress (boost::asio::ip::address::from_string (host)); diff --git a/RouterContext.cpp b/RouterContext.cpp index 962cf3ee..3dc79027 100644 --- a/RouterContext.cpp +++ b/RouterContext.cpp @@ -48,7 +48,7 @@ namespace i2p if (!port) port = rand () % (30777 - 9111) + 9111; // I2P network ports range 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 routerInfo.AddSSUAddress (host.c_str(), port, routerInfo.GetIdentHash ()); routerInfo.AddNTCPAddress (host.c_str(), port);