It might be worthwhile to snarf some code from (Free)BSD to also deal
with ceases like 10.2 == 10.0.0.2 and similar 'abbreviations'.

Dw

On Mon, 23 Jul 2001, Doug MacEachern wrote:

> 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;
>
>
>

Reply via email to