Browse Source

Do not perform a lookup for IPv4 addresses, if only listening on IPv6 sockets.

Carsten Bock 13 years ago
parent
commit
e1b3961b16
1 changed files with 4 additions and 2 deletions
  1. 4 2
      resolve.h

+ 4 - 2
resolve.h

@@ -429,8 +429,10 @@ static inline struct hostent* _resolvehost(char* name)
 	}
 	}
 #endif
 #endif
 #endif
 #endif
-	/* ipv4 */
-	he=gethostbyname(name);
+	if (socket_types & SOCKET_T_IPV4) {
+		/* ipv4 */
+		he=gethostbyname(name);
+	}
 #ifdef USE_IPV6
 #ifdef USE_IPV6
 	if(he==0 && cfg_get(core, core_cfg, dns_try_ipv6)){
 	if(he==0 && cfg_get(core, core_cfg, dns_try_ipv6)){
 #ifndef DNS_IP_HACK
 #ifndef DNS_IP_HACK