httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@attglobal.net>
Subject Re: [PATCH] improve mod_cgid robustness
Date Mon, 28 Jan 2002 12:49:17 GMT
Jeff Trawick <trawick@attglobal.net> writes:

>      memset(&unix_addr, 0, sizeof(unix_addr));
>      unix_addr.sun_family = AF_UNIX;
>      strcpy(unix_addr.sun_path, conf->sockname);
>  
> -    if (connect(sd, (struct sockaddr *)&unix_addr, sizeof(unix_addr)) < 0) {
> +    connect_tries = 0;
> +    sliding_timer = 100000; /* 100 milliseconds */
> +    while (1) {
> +        ++connect_tries;
> +        if ((sd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
>              return log_scripterror(r, conf, HTTP_INTERNAL_SERVER_ERROR, errno, 
> -                                   "unable to connect to cgi daemon");
> -    } 
> +                                   "unable to create socket to cgi daemon");
> +        }
> +        if (connect(sd, (struct sockaddr *)&unix_addr, sizeof(unix_addr)) < 0)
{
> +            if (errno == ECONNREFUSED && connect_tries < DEFAULT_CONNECT_ATTEMPTS)
{
> +                ap_log_rerror(APLOG_MARK, APLOG_DEBUG, errno, r,
 (and more)

I just noticed for the first time that the mod_include support has the
same logic.  Time for a subroutine...
-- 
Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Mime
View raw message