You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2011/02/10 14:29:53 UTC

svn commit: r1069381 - in /httpd/httpd/trunk/modules/proxy: mod_proxy_balancer.c proxy_util.c

Author: jim
Date: Thu Feb 10 13:29:53 2011
New Revision: 1069381

URL: http://svn.apache.org/viewvc?rev=1069381&view=rev
Log:
move function...

Modified:
    httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c
    httpd/httpd/trunk/modules/proxy/proxy_util.c

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c?rev=1069381&r1=1069380&r2=1069381&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c Thu Feb 10 13:29:53 2011
@@ -1327,63 +1327,6 @@ static void balancer_child_init(apr_pool
 
 }
 
-PROXY_DECLARE(apr_status_t) ap_proxy_update_members(proxy_balancer *b, server_rec *s,
-                                                    proxy_server_conf *conf)
-{
-    proxy_worker **workers;
-    int i;
-    int index;
-    proxy_worker_shared *shm;
-    if (b->s->wupdated <= b->wupdated)
-        return APR_SUCCESS;
-    /*
-     * Look thru the list of workers in shm
-     * and see which one(s) we are lacking...
-     * again, the cast to unsigned int is safe
-     * since our upper limit is always max_workers
-     * which is int.
-     */
-    for (index = 0; index < b->max_workers; index++) {
-        int found;
-        apr_status_t rv;
-        if ((rv = storage->dptr(b->slot, (unsigned int)index, (void *)&shm)) != APR_SUCCESS) {
-            ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "worker slotmem_dptr failed");
-            return APR_EGENERAL;
-        }
-        /* account for possible "holes" in the slotmem
-         * (eg: slots 0-2 are used, but 3 isn't, but 4-5 is)
-         */
-        if (!shm->hash)
-            continue;
-        found = 0;
-        workers = (proxy_worker **)b->workers->elts;
-        for (i = 0; i < b->workers->nelts; i++, workers++) {
-            proxy_worker *worker = *workers;
-            if (worker->hash == shm->hash) {
-                found = 1;
-                break;
-            }
-        }
-        if (!found) {
-            proxy_worker **runtime;
-            runtime = apr_array_push(b->workers);
-            *runtime = apr_palloc(conf->pool, sizeof(proxy_worker));
-            (*runtime)->hash = shm->hash;
-            (*runtime)->context = NULL;
-            (*runtime)->cp = NULL;
-            (*runtime)->balancer = b;
-            (*runtime)->s = shm;
-            (*runtime)->tmutex = NULL;
-            if ((rv = ap_proxy_initialize_worker(*runtime, s, conf->pool)) != APR_SUCCESS) {
-                ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "Cannot init worker");
-                return rv;
-            }
-        }
-    }
-    b->wupdated = b->s->wupdated;
-    return APR_SUCCESS;
-}
-
 static void ap_proxy_balancer_register_hook(apr_pool_t *p)
 {
     /* Only the mpm_winnt has child init hook handler.

Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=1069381&r1=1069380&r2=1069381&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Thu Feb 10 13:29:53 2011
@@ -2933,3 +2933,62 @@ PROXY_DECLARE(char *) ap_proxy_parse_wst
     return ret;
 }
 
+PROXY_DECLARE(apr_status_t) ap_proxy_update_members(proxy_balancer *b, server_rec *s,
+                                                    proxy_server_conf *conf)
+{
+    proxy_worker **workers;
+    int i;
+    int index;
+    proxy_worker_shared *shm;
+    ap_slotmem_provider_t *storage = b->storage;
+
+    if (b->s->wupdated <= b->wupdated)
+        return APR_SUCCESS;
+    /*
+     * Look thru the list of workers in shm
+     * and see which one(s) we are lacking...
+     * again, the cast to unsigned int is safe
+     * since our upper limit is always max_workers
+     * which is int.
+     */
+    for (index = 0; index < b->max_workers; index++) {
+        int found;
+        apr_status_t rv;
+        if ((rv = storage->dptr(b->slot, (unsigned int)index, (void *)&shm)) != APR_SUCCESS) {
+            ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "worker slotmem_dptr failed");
+            return APR_EGENERAL;
+        }
+        /* account for possible "holes" in the slotmem
+         * (eg: slots 0-2 are used, but 3 isn't, but 4-5 is)
+         */
+        if (!shm->hash)
+            continue;
+        found = 0;
+        workers = (proxy_worker **)b->workers->elts;
+        for (i = 0; i < b->workers->nelts; i++, workers++) {
+            proxy_worker *worker = *workers;
+            if (worker->hash == shm->hash) {
+                found = 1;
+                break;
+            }
+        }
+        if (!found) {
+            proxy_worker **runtime;
+            runtime = apr_array_push(b->workers);
+            *runtime = apr_palloc(conf->pool, sizeof(proxy_worker));
+            (*runtime)->hash = shm->hash;
+            (*runtime)->context = NULL;
+            (*runtime)->cp = NULL;
+            (*runtime)->balancer = b;
+            (*runtime)->s = shm;
+            (*runtime)->tmutex = NULL;
+            if ((rv = ap_proxy_initialize_worker(*runtime, s, conf->pool)) != APR_SUCCESS) {
+                ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "Cannot init worker");
+                return rv;
+            }
+        }
+    }
+    b->wupdated = b->s->wupdated;
+    return APR_SUCCESS;
+}
+