summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordarin%meer.net <devnull@localhost>2003-10-31 05:09:29 +0000
committerdarin%meer.net <devnull@localhost>2003-10-31 05:09:29 +0000
commit4b3f4c0a3126c6997631f48d376b75a69761b86f (patch)
tree839c2c456ae3a116ddff4bbfb22f5459a878cd9d
parent179be38bcce2fd16f94c6dd0177028164b543792 (diff)
downloadnspr-hg-4b3f4c0a3126c6997631f48d376b75a69761b86f.tar.gz
fixes bug 223811 "getaddrinfo returns 3 addrinfo structs for each IP address
[was: very long timeout for retrying IPv6 to IPv4 addresses]" r=wtc
-rw-r--r--pr/src/misc/prnetdb.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/pr/src/misc/prnetdb.c b/pr/src/misc/prnetdb.c
index eca157fa..1dca8366 100644
--- a/pr/src/misc/prnetdb.c
+++ b/pr/src/misc/prnetdb.c
@@ -2085,6 +2085,15 @@ PR_IMPLEMENT(PRAddrInfo *) PR_GetAddrInfoByName(const char *hostname,
hints.ai_flags = AI_CANONNAME;
hints.ai_family = AF_UNSPEC;
+ /*
+ * it is important to select a socket type in the hints, otherwise we
+ * will get back repetitive entries: one for each socket type. since
+ * we do not expose ai_socktype through our API, it is okay to do this
+ * here. the application may still choose to create a socket of some
+ * other type.
+ */
+ hints.ai_socktype = SOCK_STREAM;
+
rv = GETADDRINFO(hostname, NULL, &hints, &res);
if (rv == 0)
return (PRAddrInfo *) res;