listen_try also ignore dns errors

This commit is contained in:
proller 2018-03-12 18:48:55 +03:00
parent bc03ebc802
commit 927b5a432e

View File

@ -335,14 +335,15 @@ int Server::main(const std::vector<std::string> & /*args*/)
}
catch (const Poco::Net::DNSException & e)
{
if (e.code() == EAI_FAMILY
const auto code = e.code();
if (code == EAI_FAMILY
#if defined(EAI_ADDRFAMILY)
|| e.code() == EAI_ADDRFAMILY
|| code == EAI_ADDRFAMILY
#endif
)
{
LOG_ERROR(log,
"Cannot resolve listen_host (" << host << "), error: " << e.message() << ". "
"Cannot resolve listen_host (" << host << "), error " << e.code() << ": " << e.message() << ". "
"If it is an IPv6 address and your host has disabled IPv6, then consider to "
"specify IPv4 address to listen in <listen_host> element of configuration "
"file. Example: <listen_host>0.0.0.0</listen_host>");
@ -457,8 +458,13 @@ int Server::main(const std::vector<std::string> & /*args*/)
}
catch (const Poco::Net::NetException & e)
{
if (listen_try && (e.code() == POCO_EPROTONOSUPPORT || e.code() == POCO_EADDRNOTAVAIL))
LOG_ERROR(log, "Listen [" << listen_host << "]: " << e.what() << ": " << e.message()
const auto code = e.code();
if (listen_try && (code == POCO_EPROTONOSUPPORT || code == POCO_EADDRNOTAVAIL || code == EAI_FAMILY
#if defined(EAI_ADDRFAMILY)
|| code == EAI_ADDRFAMILY
#endif
))
LOG_ERROR(log, "Listen [" << listen_host << "]: " << e.code() << ": " << e.what() << ": " << e.message()
<< " If it is an IPv6 or IPv4 address and your host has disabled IPv6 or IPv4, then consider to "
"specify not disabled IPv4 or IPv6 address to listen in <listen_host> element of configuration "
"file. Example for disabled IPv6: <listen_host>0.0.0.0</listen_host> ."