[Mono-bugs] [Bug 60175][Nor] New - Slow GetHostByName
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Mon, 14 Jun 2004 19:33:05 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by lluis@ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=60175
--- shadow/60175 2004-06-14 19:33:05.000000000 -0400
+++ shadow/60175.tmp.7013 2004-06-14 19:33:05.000000000 -0400
@@ -0,0 +1,39 @@
+Bug#: 60175
+Product: Mono: Runtime
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: lluis@ximian.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Slow GetHostByName
+
+In my RH9 Dns.GetHostByName() takes a lot of time to resolve an address. I
+found out that all that time is spent trying to resolve the name in IPv6. I
+can easily fix this by only trying IPv6 lookup if the IPv4 lookup fails,
+doing something like this:
+
+- while (gethostbyname2_r(hostname, AF_INET6, &he2, buffer2,
+- buffer_size2, &hp2, &herr) == ERANGE) {
+- buffer_size2 *= 2;
+- buffer2 = g_realloc(buffer2, buffer_size2);
++ if (hp1 == NULL)
++ {
++ while (gethostbyname2_r(hostname, AF_INET6, &he2, buffer2,
++ buffer_size2, &hp2, &herr) == ERANGE) {
++ buffer_size2 *= 2;
++ buffer2 = g_realloc(buffer2, buffer_size2);
++ }
+ }
++ else
++ hp2 = NULL;
+
+I'm not sure this is correct, but it makes sense to me.