apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug MacEachern <do...@covalent.net>
Subject apr_sockaddr_info_get + server startup time
Date Mon, 23 Jul 2001 22:02:26 GMT
with a small number of vhosts configured, it takes ages for the server to
start.  the bottleneck is alloc_listener() -> apr_sockaddr_info_get() ->
getaddrinfo() call with the default "0.0.0.0" address.  this patch avoids
the lengthy lookup time and the server fires up right away.  could this be
done for any hostname that is an ip address (looks_like_ip(hostname)) ?
any other suggestions welcome, the current server startup time is
unbearable, especially behind a slow dialup line.

--- srclib/apr/network_io/unix/sa_common.c      2001/07/23 16:05:00    1.36
+++ srclib/apr/network_io/unix/sa_common.c      2001/07/23 21:36:43
@@ -341,7 +341,12 @@
         char num[8];
 
         memset(&hints, 0, sizeof(hints));
-        hints.ai_flags = AI_CANONNAME;
+        if (strcmp(hostname, "0.0.0.0") == 0) {
+            hints.ai_flags = AI_NUMERICHOST;
+        }
+        else {
+            hints.ai_flags = AI_CANONNAME;
+        }
         hints.ai_family = family;
         hints.ai_socktype = SOCK_STREAM;
         hints.ai_protocol = 0;



Mime
View raw message