httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruediger Pluem <rpl...@apache.org>
Subject Re: proxy_ajp connect timeout fix.
Date Thu, 09 Oct 2008 20:43:54 GMT


On 10/09/2008 10:11 PM, Matt Stevenson wrote:
> Had a bit more time, here is a patch that should work for Unix which have "apr_wait_for_io_or_timeout"
available. I can't test windows/others so that's the reason for the ifdef.
> 
> ProxyPass / balance://hotcluster/
> <Proxy balance://hotcluster>
>   # defaultish tomcat
>   BalancerMember ajp://10.136.130.111:7009  loadfactor=1 connectiontimeout=2
>   # below IP is not reachable, acts like a down box
>   BalancerMember ajp://192.168.0.7:7010  loadfactor=1 connectiontimeout=2
> </Proxy>
> 
> 
> Index: modules/proxy/proxy_util.c
> ===================================================================
> --- modules/proxy/proxy_util.c  (revision 703219)
> +++ modules/proxy/proxy_util.c  (working copy)
> @@ -2358,9 +2358,18 @@
>                       "proxy: %s: fam %d socket created to connect to %s",
>                       proxy_function, backend_addr->family, worker->hostname);
> 
> +        /* use non blocking for connect timeouts to work. The ifdef
> +           limits to unix systems which have apr_wait_for_io_or_timeout.
> +           TODO: remove the ifdef and see what works/breaks */
> +#ifdef USE_WAIT_FOR_IO
> +        apr_socket_opt_set(newsock,  APR_SO_NONBLOCK, 1);
> +#endif
>          /* make the connection out of the socket */
>          rv = apr_socket_connect(newsock, backend_addr);
> 
> +#ifdef USE_WAIT_FOR_IO
> +        apr_socket_opt_set(newsock,  APR_SO_NONBLOCK, 0);
> +#endif
>          /* if an error occurred, loop round and try again */
>          if (rv != APR_SUCCESS) {
>              apr_socket_close(newsock);
> 

According to the APR source files only older versions of BeOS do not provide apr_wait_for_io_or_timeout.
So I would say that it is pretty much save to remove the ifdef's

Regards

RĂ¼diger


Mime
View raw message