On 6/21/21 7:03 PM, minf...@apache.org wrote:
> Author: minfrin
> Date: Mon Jun 21 17:03:35 2021
> New Revision: 1890947
> 
> URL: http://svn.apache.org/viewvc?rev=1890947&view=rev
> Log:
> *) back port: Add CPING to health check logic.
>    Trunk version of patch:
>         https://svn.apache.org/r1887415
>    Backport version for 2.4.x of patch:
>       Trunk version of patch works
>       svn merge -c 1887415 ^/httpd/httpd/trunk .
>    +1: jfclere, jim, minfrin
> 
> 
> Modified:
>     httpd/httpd/branches/2.4.x/   (props changed)
>     httpd/httpd/branches/2.4.x/CHANGES
>     httpd/httpd/branches/2.4.x/STATUS
>     httpd/httpd/branches/2.4.x/include/ap_mmn.h
>     httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy.h
>     httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_ajp.c
>     httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_balancer.c
>     httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_hcheck.c
> 
> Propchange: httpd/httpd/branches/2.4.x/
> ------------------------------------------------------------------------------
>   Merged /httpd/httpd/trunk:r1887415
> 

> 
> Modified: httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_hcheck.c
> URL: 
> http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_hcheck.c?rev=1890947&r1=1890946&r2=1890947&view=diff
> ==============================================================================
> --- httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_hcheck.c (original)
> +++ httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_hcheck.c Mon Jun 21 
> 17:03:35 2021

> @@ -613,6 +615,39 @@ static int hc_get_backend(const char *pr
>      return hc_determine_connection(ctx, hc, &(*backend)->addr, ptemp);
>  }
>  
> +static apr_status_t hc_check_cping(baton_t *baton)
> +{
> +    int status;
> +    sctx_t *ctx = baton->ctx;
> +    proxy_worker *hc = baton->hc;
> +    proxy_conn_rec *backend = NULL;
> +    apr_pool_t *ptemp = baton->ptemp;
> +    request_rec *r;
> +    apr_interval_time_t timeout;
> +
> +    if (!ajp_handle_cping_cpong) {
> +        return APR_ENOTIMPL;
> +    }
> +
> +    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, baton->ctx->s, "HCCPING 
> starting");
> +    if ((status = hc_get_backend("HCCPING", &backend, hc, ctx, 
> baton->ptemp)) != OK) {
> +        return backend_cleanup("HCCPING", backend, ctx->s, status);
> +    }
> +    if ((status = ap_proxy_connect_backend("HCCPING", backend, hc, ctx->s)) 
> != OK) {
> +        return backend_cleanup("HCCPING", backend, ctx->s, status);
> +    }
> +    r = create_request_rec(ptemp, ctx->s, baton->balancer, "CPING");
> +    if ((status = ap_proxy_connection_create_ex("HCCPING", backend, r)) != 
> OK) {
> +        return backend_cleanup("HCCPING", backend, ctx->s, status);
> +    }
> +    set_request_connection(r, backend->connection);
> +
> +    timeout = apr_time_from_sec(10); /* 10 seconds */

Sorry for jumping on this late, but as I already mentioned on the original 
trunk revision a hard coded timeout is bad.
Please also backport r1887439. For the record I am +1 on backporting r1887439.

Regards

RĂ¼diger

Reply via email to