From: William A. Rowe Jr Date: Wed, 11 Aug 2004 22:13:50 +0000 (+0000) Subject: Make proxy_conn always accesible for preforked MPM and X-Git-Tag: post_ajp_proxy~45 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c460a77e848034462e4d2295a1080d3f2f987438;p=apache Make proxy_conn always accesible for preforked MPM and APR_HAS_THREADS enabled. Add init_conn_worker for creating apr_reslist that maintains connection pool. For prefork mpm's use the single connection container. Submitted by: mturk git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@104585 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/mod_proxy.h b/modules/proxy/mod_proxy.h index 0f1b3471ee..e1a050b438 100644 --- a/modules/proxy/mod_proxy.h +++ b/modules/proxy/mod_proxy.h @@ -205,9 +205,8 @@ typedef struct { apr_sockaddr_t *addr; /* Preparsed remote address info */ #if APR_HAS_THREADS apr_reslist_t *res; /* Connection resource list */ -#else - proxy_conn *conn; /* Single connection for prefork mpm's */ #endif + proxy_conn *conn; /* Single connection for prefork mpm's */ } proxy_conn_pool; /* Worker configuration */ diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index 506d9afdaa..7090b1201f 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -1355,6 +1355,31 @@ static apr_status_t connection_destructor(void *resource, void *params, return APR_SUCCESS; } +static apr_status_t init_conn_worker(proxy_worker *worker, server_rec *s) +{ + apr_status_t rv; +#if APR_HAS_THREADS + if (worker->hmax) { + rv = apr_reslist_create(&(worker->cp->res), + worker->min, worker->smax, + worker->hmax, worker->ttl, + connection_constructor, connection_destructor, + s, worker->cp->pool); + } + else +#endif + { + worker->cp->conn = apr_pcalloc(worker->cp->pool, sizeof(proxy_conn)); + /* register the pool cleanup */ + apr_pool_cleanup_register(worker->cp->pool, (void *)worker->cp->conn, + proxy_conn_cleanup, apr_pool_cleanup_null); + + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, + "proxy: socket is created"); + rv = APR_SUCCESS; + } + return rv; +} PROXY_DECLARE(apr_status_t) ap_proxy_determine_connection(apr_pool_t *p, request_rec *r,