]> granicus.if.org Git - apache/commitdiff
Make proxy_conn always accesible for preforked MPM and
authorWilliam A. Rowe Jr <wrowe@apache.org>
Wed, 11 Aug 2004 22:13:50 +0000 (22:13 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Wed, 11 Aug 2004 22:13:50 +0000 (22:13 +0000)
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

modules/proxy/mod_proxy.h
modules/proxy/proxy_util.c

index 0f1b3471eee28789ede67aca9e8816a64e1362e8..e1a050b438eb52c6a18a8aa4e9d8f2c8a13eebeb 100644 (file)
@@ -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 */
index 506d9afdaa48289f3916af941722c1de73088cea..7090b1201f23d95989faafdb4fe5e0137653fd02 100644 (file)
@@ -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,