Skip to content

Commit

Permalink
Remove the address_configured flag on tcp::resolver::query (#1145)
Browse files Browse the repository at this point in the history
The default behavior for tcp::resolver::query uses the
address_configured flag, which only returns addresses if a non-loopback
address is available on the system. If this is called before a real network
interface is brought up, then resolution will fail and the server won't
be functional, even for requests on the loopback interface.

Explicitly set the flags to default so that the address_configured flag
is not specified. This allows the server to start up normally even when
the system has no active network interfaces.
  • Loading branch information
robhancocksed authored and BillyONeal committed Jun 13, 2019
1 parent be807d4 commit 36e030a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Release/src/http/listener/http_server_asio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,9 @@ void hostport_listener::start()
auto& service = crossplat::threadpool::shared_instance().service();
tcp::resolver resolver(service);
// #446: boost resolver does not recognize "+" as a host wildchar
tcp::resolver::query query = ("+" == m_host) ? tcp::resolver::query(m_port) : tcp::resolver::query(m_host, m_port);
tcp::resolver::query query = ("+" == m_host) ?
tcp::resolver::query(m_port, boost::asio::ip::resolver_query_base::flags()) :
tcp::resolver::query(m_host, m_port, boost::asio::ip::resolver_query_base::flags());

tcp::endpoint endpoint = *resolver.resolve(query);

Expand Down

0 comments on commit 36e030a

Please sign in to comment.