nghttpx: Retry getaddrinfo without AI_ADDRCONFIG
This commit is contained in:
parent
7dc39b1ee9
commit
f41ac103d3
|
@ -715,6 +715,13 @@ int create_tcp_server_socket(UpstreamAddr &faddr,
|
|||
|
||||
addrinfo *res, *rp;
|
||||
rv = getaddrinfo(node, service.c_str(), &hints, &res);
|
||||
#ifdef AI_ADDRCONFIG
|
||||
if (rv != 0) {
|
||||
// Retry without AI_ADDRCONFIG
|
||||
hints.ai_flags &= ~AI_ADDRCONFIG;
|
||||
rv = getaddrinfo(node, service.c_str(), &hints, &res);
|
||||
}
|
||||
#endif // AI_ADDRCONFIG
|
||||
if (rv != 0) {
|
||||
LOG(FATAL) << "Unable to get IPv" << (faddr.family == AF_INET ? "4" : "6")
|
||||
<< " address for " << faddr.host << ", port " << faddr.port
|
||||
|
|
|
@ -3761,6 +3761,13 @@ int resolve_hostname(Address *addr, const char *hostname, uint16_t port,
|
|||
addrinfo *res;
|
||||
|
||||
rv = getaddrinfo(hostname, service.c_str(), &hints, &res);
|
||||
#ifdef AI_ADDRCONFIG
|
||||
if (rv != 0) {
|
||||
// Retry without AI_ADDRCONFIG
|
||||
hints.ai_flags &= ~AI_ADDRCONFIG;
|
||||
rv = getaddrinfo(hostname, service.c_str(), &hints, &res);
|
||||
}
|
||||
#endif // AI_ADDRCONFIG
|
||||
if (rv != 0) {
|
||||
LOG(FATAL) << "Unable to resolve address for " << hostname << ": "
|
||||
<< gai_strerror(rv);
|
||||
|
|
Loading…
Reference in New Issue