Fix DNS failures in offline mode preventing daemon startup

This commit is contained in:
moneromooo-monero 2016-11-23 23:08:53 +00:00
parent dbf2ab56c5
commit 17b6bd6d35
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
3 changed files with 5 additions and 5 deletions

View file

@ -727,7 +727,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
m_address = address; m_address = address;
// Open the acceptor with the option to reuse the address (i.e. SO_REUSEADDR). // Open the acceptor with the option to reuse the address (i.e. SO_REUSEADDR).
boost::asio::ip::tcp::resolver resolver(io_service_); boost::asio::ip::tcp::resolver resolver(io_service_);
boost::asio::ip::tcp::resolver::query query(address, boost::lexical_cast<std::string>(port)); boost::asio::ip::tcp::resolver::query query(address, boost::lexical_cast<std::string>(port), boost::asio::ip::tcp::resolver::query::canonical_name);
boost::asio::ip::tcp::endpoint endpoint = *resolver.resolve(query); boost::asio::ip::tcp::endpoint endpoint = *resolver.resolve(query);
acceptor_.open(endpoint.protocol()); acceptor_.open(endpoint.protocol());
acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true)); acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
@ -970,7 +970,7 @@ POP_WARNINGS
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
boost::asio::ip::tcp::resolver resolver(io_service_); boost::asio::ip::tcp::resolver resolver(io_service_);
boost::asio::ip::tcp::resolver::query query(boost::asio::ip::tcp::v4(), adr, port); boost::asio::ip::tcp::resolver::query query(boost::asio::ip::tcp::v4(), adr, port, boost::asio::ip::tcp::resolver::query::canonical_name);
boost::asio::ip::tcp::resolver::iterator iterator = resolver.resolve(query); boost::asio::ip::tcp::resolver::iterator iterator = resolver.resolve(query);
boost::asio::ip::tcp::resolver::iterator end; boost::asio::ip::tcp::resolver::iterator end;
if(iterator == end) if(iterator == end)
@ -1074,7 +1074,7 @@ POP_WARNINGS
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
boost::asio::ip::tcp::resolver resolver(io_service_); boost::asio::ip::tcp::resolver resolver(io_service_);
boost::asio::ip::tcp::resolver::query query(boost::asio::ip::tcp::v4(), adr, port); boost::asio::ip::tcp::resolver::query query(boost::asio::ip::tcp::v4(), adr, port, boost::asio::ip::tcp::resolver::query::canonical_name);
boost::asio::ip::tcp::resolver::iterator iterator = resolver.resolve(query); boost::asio::ip::tcp::resolver::iterator iterator = resolver.resolve(query);
boost::asio::ip::tcp::resolver::iterator end; boost::asio::ip::tcp::resolver::iterator end;
if(iterator == end) if(iterator == end)

View file

@ -339,7 +339,7 @@ namespace nodetool
io_service io_srv; io_service io_srv;
ip::tcp::resolver resolver(io_srv); ip::tcp::resolver resolver(io_srv);
ip::tcp::resolver::query query(host, port); ip::tcp::resolver::query query(host, port, boost::asio::ip::tcp::resolver::query::canonical_name);
boost::system::error_code ec; boost::system::error_code ec;
ip::tcp::resolver::iterator i = resolver.resolve(query, ec); ip::tcp::resolver::iterator i = resolver.resolve(query, ec);
CHECK_AND_ASSERT_MES_NO_RET(!ec, "Failed to resolve host name '" << host << "': " << ec.message() << ':' << ec.value()); CHECK_AND_ASSERT_MES_NO_RET(!ec, "Failed to resolve host name '" << host << "': " << ec.message() << ':' << ec.value());

View file

@ -61,7 +61,7 @@ bool isAddressLocal(const std::string &address)
// resolve to IP // resolve to IP
boost::asio::io_service io_service; boost::asio::io_service io_service;
boost::asio::ip::tcp::resolver resolver(io_service); boost::asio::ip::tcp::resolver resolver(io_service);
boost::asio::ip::tcp::resolver::query query(u_c.host, ""); boost::asio::ip::tcp::resolver::query query(u_c.host, "", boost::asio::ip::tcp::resolver::query::canonical_name);
boost::asio::ip::tcp::resolver::iterator i = resolver.resolve(query); boost::asio::ip::tcp::resolver::iterator i = resolver.resolve(query);
while (i != boost::asio::ip::tcp::resolver::iterator()) while (i != boost::asio::ip::tcp::resolver::iterator())
{ {