httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruediger Pluem <rpl...@apache.org>
Subject Re: svn commit: r1725523 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.h mod_proxy_hcheck.c
Date Tue, 19 Jan 2016 16:09:13 GMT


On 01/19/2016 03:14 PM, jim@apache.org wrote:
> Author: jim
> Date: Tue Jan 19 14:14:27 2016
> New Revision: 1725523
> 
> URL: http://svn.apache.org/viewvc?rev=1725523&view=rev
> Log:
> For OPTIONS and HEAD, only 2xx and 3xx are considered "passing"
> (until I implement the conditions expr testing)... honor
> the pass/fail count and LOG_INFO when the health check enables
> or disables a backend worker.
> 
> Modified:
>     httpd/httpd/trunk/modules/proxy/mod_proxy.h
>     httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.c
> 

> 
> Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.c?rev=1725523&r1=1725522&r2=1725523&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.c (original)
> +++ httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.c Tue Jan 19 14:14:27 2016

> @@ -647,10 +662,29 @@ static void hc_check(sctx_t *ctx, apr_po
>                           "Somehow tried to use unimplemented hcheck method: %d", (int)worker->s->method);
>          return;
>      }
> -    /* TODO Honor fails and passes */
> -    ap_proxy_set_wstatus('#', (rv == APR_SUCCESS ? 0 : 1), worker);
> -    if (rv != APR_SUCCESS) {
> -        worker->s->error_time = now;
> +    /* what state are we in ? */
> +    if (PROXY_WORKER_IS_HCFAILED(worker)) {
> +        if (rv == APR_SUCCESS) {
> +            worker->s->pcount += 1;
> +            if (worker->s->pcount >= worker->s->passes) {
> +                ap_proxy_set_wstatus('#', 0, worker);
> +                worker->s->pcount = 0;
> +                ap_log_error(APLOG_MARK, APLOG_INFO, 0, s, APLOGNO()
> +                             "Health check re-enabling %s", worker->s->name);
> +
> +            }
> +        }
> +    } else {
> +        if (rv != APR_SUCCESS) {
> +            worker->s->error_time = now;
> +            worker->s->fcount += 1;
> +            if (worker->s->fcount >= worker->s->fails) {
> +                ap_proxy_set_wstatus('#', 1, worker);

Wouldn't it be better to use the define from mod_proxy.h instead of the literal?

> +                worker->s->fcount = 0;
> +                ap_log_error(APLOG_MARK, APLOG_INFO, 0, s, APLOGNO()
> +                             "Health check disabling %s", worker->s->name);
> +            }
> +        }
>      }
>      worker->s->updated = now;
>  }
> 
> 
> 


Regards

RĂ¼diger

Mime
View raw message