Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 51104 invoked from network); 11 Aug 2004 22:30:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 11 Aug 2004 22:30:09 -0000 Received: (qmail 53450 invoked by uid 500); 11 Aug 2004 22:30:08 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 53410 invoked by uid 500); 11 Aug 2004 22:30:08 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 53397 invoked by uid 500); 11 Aug 2004 22:30:08 -0000 Delivered-To: apmail-httpd-2.0-cvs@apache.org Received: (qmail 53392 invoked by uid 99); 11 Aug 2004 22:30:07 -0000 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.27.1) with SMTP; Wed, 11 Aug 2004 15:30:07 -0700 Received: (qmail 51081 invoked by uid 1134); 11 Aug 2004 22:30:07 -0000 Date: 11 Aug 2004 22:30:07 -0000 Message-ID: <20040811223007.51080.qmail@minotaur.apache.org> From: wrowe@apache.org To: httpd-2.0-cvs@apache.org Subject: cvs commit: httpd-2.0/modules/proxy mod_proxy.c mod_proxy.h proxy_util.c X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N wrowe 2004/08/11 15:30:07 Modified: modules/proxy mod_proxy.c mod_proxy.h proxy_util.c Log: Added acquire timeout for obtaining resources from reslist. The timeout is in milliseconds to enable quick return in case the reslist is exceded the maximum number of connections. Submitted by: mturk Revision Changes Path 1.119 +8 -1 httpd-2.0/modules/proxy/mod_proxy.c Index: mod_proxy.c =================================================================== RCS file: /home/cvs/httpd-2.0/modules/proxy/mod_proxy.c,v retrieving revision 1.118 retrieving revision 1.119 diff -u -r1.118 -r1.119 --- mod_proxy.c 11 Aug 2004 22:28:59 -0000 1.118 +++ mod_proxy.c 11 Aug 2004 22:30:06 -0000 1.119 @@ -92,7 +92,7 @@ else if (!strcasecmp(key, "ttl")) { ival = atoi(val); if (ival < 1) - return "ttl must be al least one second"; + return "ttl must be at least one second"; worker->ttl = apr_time_from_sec(ival); } else if (!strcasecmp(key, "min")) { @@ -114,6 +114,13 @@ return "smax must be a positive number"; worker->smax = ival; } + else if (!strcasecmp(key, "acquire")) { + ival = atoi(val); + if (ival < 1) + return "acquire must be at least one mili second"; + worker->acquire = apr_time_make(0, ival * 1000); + worker->acquire_set = 1; + } else { return "unknown parameter"; } 1.106 +2 -1 httpd-2.0/modules/proxy/mod_proxy.h Index: mod_proxy.h =================================================================== RCS file: /home/cvs/httpd-2.0/modules/proxy/mod_proxy.h,v retrieving revision 1.105 retrieving revision 1.106 diff -u -r1.105 -r1.106 --- mod_proxy.h 11 Aug 2004 22:28:59 -0000 1.105 +++ mod_proxy.h 11 Aug 2004 22:30:06 -0000 1.106 @@ -228,7 +228,8 @@ apr_interval_time_t ttl; /* maximum amount of time in seconds a connection * may be available while exceeding the soft limit */ apr_interval_time_t timeout; /* connection timeout */ - + apr_interval_time_t acquire; /* acquire timeout when the maximum number of connections is exceeded */ + char acquire_set; proxy_conn_pool *cp; /* Connection pool to use */ void *opaque; /* per scheme worker data */ }; 1.120 +36 -0 httpd-2.0/modules/proxy/proxy_util.c Index: proxy_util.c =================================================================== RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_util.c,v retrieving revision 1.119 retrieving revision 1.120 diff -u -r1.119 -r1.120 --- proxy_util.c 11 Aug 2004 22:28:59 -0000 1.119 +++ proxy_util.c 11 Aug 2004 22:30:06 -0000 1.120 @@ -1364,6 +1364,37 @@ return APR_SUCCESS; } +/* low level connection acquire/release functions + * they are hiding apr_reslist for nothreaded or prefork servers. + */ +static apr_status_t acquire_connection_low(proxy_conn_rec **conn, proxy_worker *worker) +{ + apr_status_t rv; +#if APR_HAS_THREADS + if (worker->hmax) { + rv = apr_reslist_acquire(worker->cp->res, (void **)conn); + } + else +#endif + { + *conn = worker->cp->conn; + rv = APR_SUCCESS; + } + return rv; +} + +static apr_status_t release_connection_low(proxy_conn_rec *conn, proxy_worker *worker) +{ + apr_status_t rv = APR_SUCCESS; +#if APR_HAS_THREADS + if (worker->hmax) { + rv = apr_reslist_release(worker->cp->res, (void *)conn); + } +#endif + return rv; +} + + static apr_status_t init_conn_worker(proxy_worker *worker, server_rec *s) { apr_status_t rv; @@ -1374,6 +1405,11 @@ worker->hmax, worker->ttl, connection_constructor, connection_destructor, s, worker->cp->pool); +#if (APR_MAJOR_VERSION > 0) + /* Set the acquire timeout */ + if (rv == APR_SUCCESS && worker->acquire_set) + apr_reslist_timeout_set(worker->cp->res, worker->acquire); +#endif } else #endif