httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jfcl...@apache.org
Subject svn commit: r771940 - in /httpd/httpd/trunk/modules/proxy: ./ balancers/ examples/
Date Tue, 05 May 2009 17:15:49 GMT
Author: jfclere
Date: Tue May  5 17:15:48 2009
New Revision: 771940

URL: http://svn.apache.org/viewvc?rev=771940&view=rev
Log:
Change the order of mod_proxy and mod_proxy_balancer child_init().
Change the balancer workers area to the address of workers instead copying the workers.
Arrange lbmethod accordingly.
Move the creation of conf->forward worker to mod_proxy child_init().

Modified:
    httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_bybusyness.c
    httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_byrequests.c
    httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_bytraffic.c
    httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_heartbeat.c
    httpd/httpd/trunk/modules/proxy/examples/mod_lbmethod_rr.c
    httpd/httpd/trunk/modules/proxy/mod_proxy.c
    httpd/httpd/trunk/modules/proxy/mod_proxy.h
    httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c
    httpd/httpd/trunk/modules/proxy/proxy_util.c

Modified: httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_bybusyness.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_bybusyness.c?rev=771940&r1=771939&r2=771940&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_bybusyness.c (original)
+++ httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_bybusyness.c Tue May  5 17:15:48
2009
@@ -27,7 +27,7 @@
 {
 
     int i;
-    proxy_worker *worker;
+    proxy_worker **worker;
     proxy_worker *mycandidate = NULL;
     int cur_lbset = 0;
     int max_lbset = 0;
@@ -46,17 +46,17 @@
         checking_standby = checked_standby = 0;
         while (!mycandidate && !checked_standby) {
 
-            worker = (proxy_worker *)balancer->workers->elts;
+            worker = (proxy_worker **)balancer->workers->elts;
             for (i = 0; i < balancer->workers->nelts; i++, worker++) {
                 if  (!checking_standby) {    /* first time through */
-                    if (worker->s->lbset > max_lbset)
-                        max_lbset = worker->s->lbset;
+                    if ((*worker)->s->lbset > max_lbset)
+                        max_lbset = (*worker)->s->lbset;
                 }
 
-                if (worker->s->lbset != cur_lbset)
+                if ((*worker)->s->lbset != cur_lbset)
                     continue;
 
-                if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(worker) : PROXY_WORKER_IS_STANDBY(worker))
)
+                if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(*worker) : PROXY_WORKER_IS_STANDBY(*worker))
)
                     continue;
 
                 /* If the worker is in error state run
@@ -65,21 +65,21 @@
                  * The worker might still be unusable, but we try
                  * anyway.
                  */
-                if (!PROXY_WORKER_IS_USABLE(worker))
-                    ap_proxy_retry_worker("BALANCER", worker, r->server);
+                if (!PROXY_WORKER_IS_USABLE(*worker))
+                    ap_proxy_retry_worker("BALANCER", *worker, r->server);
 
                 /* Take into calculation only the workers that are
                  * not in error state or not disabled.
                  */
-                if (PROXY_WORKER_IS_USABLE(worker)) {
+                if (PROXY_WORKER_IS_USABLE(*worker)) {
 
-                    worker->s->lbstatus += worker->s->lbfactor;
-                    total_factor += worker->s->lbfactor;
+                    (*worker)->s->lbstatus += (*worker)->s->lbfactor;
+                    total_factor += (*worker)->s->lbfactor;
                     
                     if (!mycandidate
-                        || worker->s->busy < mycandidate->s->busy
-                        || (worker->s->busy == mycandidate->s->busy &&
worker->s->lbstatus > mycandidate->s->lbstatus))
-                        mycandidate = worker;
+                        || (*worker)->s->busy < mycandidate->s->busy
+                        || ((*worker)->s->busy == mycandidate->s->busy &&
(*worker)->s->lbstatus > mycandidate->s->lbstatus))
+                        mycandidate = *worker;
 
                 }
 

Modified: httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_byrequests.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_byrequests.c?rev=771940&r1=771939&r2=771940&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_byrequests.c (original)
+++ httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_byrequests.c Tue May  5 17:15:48
2009
@@ -73,7 +73,7 @@
 {
     int i;
     int total_factor = 0;
-    proxy_worker *worker;
+    proxy_worker **worker;
     proxy_worker *mycandidate = NULL;
     int cur_lbset = 0;
     int max_lbset = 0;
@@ -88,15 +88,15 @@
     do {
         checking_standby = checked_standby = 0;
         while (!mycandidate && !checked_standby) {
-            worker = (proxy_worker *)balancer->workers->elts;
+            worker = (proxy_worker **)balancer->workers->elts;
             for (i = 0; i < balancer->workers->nelts; i++, worker++) {
                 if (!checking_standby) {    /* first time through */
-                    if (worker->s->lbset > max_lbset)
-                        max_lbset = worker->s->lbset;
+                    if ((*worker)->s->lbset > max_lbset)
+                        max_lbset = (*worker)->s->lbset;
                 }
-                if (worker->s->lbset != cur_lbset)
+                if ((*worker)->s->lbset != cur_lbset)
                     continue;
-                if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(worker) : PROXY_WORKER_IS_STANDBY(worker))
)
+                if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(*worker) : PROXY_WORKER_IS_STANDBY(*worker))
)
                     continue;
                 /* If the worker is in error state run
                  * retry on that worker. It will be marked as
@@ -104,16 +104,16 @@
                  * The worker might still be unusable, but we try
                  * anyway.
                  */
-                if (!PROXY_WORKER_IS_USABLE(worker))
-                    ap_proxy_retry_worker("BALANCER", worker, r->server);
+                if (!PROXY_WORKER_IS_USABLE(*worker))
+                    ap_proxy_retry_worker("BALANCER", *worker, r->server);
                 /* Take into calculation only the workers that are
                  * not in error state or not disabled.
                  */
-                if (PROXY_WORKER_IS_USABLE(worker)) {
-                    worker->s->lbstatus += worker->s->lbfactor;
-                    total_factor += worker->s->lbfactor;
-                    if (!mycandidate || worker->s->lbstatus > mycandidate->s->lbstatus)
-                        mycandidate = worker;
+                if (PROXY_WORKER_IS_USABLE(*worker)) {
+                    (*worker)->s->lbstatus += (*worker)->s->lbfactor;
+                    total_factor += (*worker)->s->lbfactor;
+                    if (!mycandidate || (*worker)->s->lbstatus > mycandidate->s->lbstatus)
+                        mycandidate = *worker;
                 }
             }
             checked_standby = checking_standby++;

Modified: httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_bytraffic.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_bytraffic.c?rev=771940&r1=771939&r2=771940&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_bytraffic.c (original)
+++ httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_bytraffic.c Tue May  5 17:15:48
2009
@@ -45,7 +45,7 @@
     int i;
     apr_off_t mytraffic = 0;
     apr_off_t curmin = 0;
-    proxy_worker *worker;
+    proxy_worker **worker;
     proxy_worker *mycandidate = NULL;
     int cur_lbset = 0;
     int max_lbset = 0;
@@ -60,15 +60,15 @@
     do {
         checking_standby = checked_standby = 0;
         while (!mycandidate && !checked_standby) {
-            worker = (proxy_worker *)balancer->workers->elts;
+            worker = (proxy_worker **)balancer->workers->elts;
             for (i = 0; i < balancer->workers->nelts; i++, worker++) {
                 if (!checking_standby) {    /* first time through */
-                    if (worker->s->lbset > max_lbset)
-                        max_lbset = worker->s->lbset;
+                    if ((*worker)->s->lbset > max_lbset)
+                        max_lbset = (*worker)->s->lbset;
                 }
-                if (worker->s->lbset != cur_lbset)
+                if ((*worker)->s->lbset != cur_lbset)
                     continue;
-                if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(worker) : PROXY_WORKER_IS_STANDBY(worker))
)
+                if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(*worker) : PROXY_WORKER_IS_STANDBY(*worker))
)
                     continue;
                 /* If the worker is in error state run
                  * retry on that worker. It will be marked as
@@ -76,16 +76,16 @@
                  * The worker might still be unusable, but we try
                  * anyway.
                  */
-                if (!PROXY_WORKER_IS_USABLE(worker))
-                    ap_proxy_retry_worker("BALANCER", worker, r->server);
+                if (!PROXY_WORKER_IS_USABLE(*worker))
+                    ap_proxy_retry_worker("BALANCER", *worker, r->server);
                 /* Take into calculation only the workers that are
                  * not in error state or not disabled.
                  */
-                if (PROXY_WORKER_IS_USABLE(worker)) {
-                    mytraffic = (worker->s->transferred/worker->s->lbfactor)
+
-                                (worker->s->read/worker->s->lbfactor);
+                if (PROXY_WORKER_IS_USABLE(*worker)) {
+                    mytraffic = ((*worker)->s->transferred/(*worker)->s->lbfactor)
+
+                                ((*worker)->s->read/(*worker)->s->lbfactor);
                     if (!mycandidate || mytraffic < curmin) {
-                        mycandidate = worker;
+                        mycandidate = *worker;
                         curmin = mytraffic;
                     }
                 }

Modified: httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_heartbeat.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_heartbeat.c?rev=771940&r1=771939&r2=771940&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_heartbeat.c (original)
+++ httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_heartbeat.c Tue May  5 17:15:48
2009
@@ -223,7 +223,7 @@
     apr_status_t rv;
     int i;
     apr_uint32_t openslots = 0;
-    proxy_worker *worker;
+    proxy_worker **worker;
     hb_server_t *server;
     apr_array_header_t *up_servers;
     proxy_worker *mycandidate = NULL;
@@ -251,19 +251,19 @@
     up_servers = apr_array_make(tpool, apr_hash_count(servers), sizeof(hb_server_t *));
 
     for (i = 0; i < balancer->workers->nelts; i++) {
-        worker = &APR_ARRAY_IDX(balancer->workers, i, proxy_worker);
-        server = apr_hash_get(servers, worker->hostname, APR_HASH_KEY_STRING);
+        worker = &APR_ARRAY_IDX(balancer->workers, i, proxy_worker *);
+        server = apr_hash_get(servers, (*worker)->hostname, APR_HASH_KEY_STRING);
 
         if (!server) {
             continue;
         }
 
-        if (!PROXY_WORKER_IS_USABLE(worker)) {
-            ap_proxy_retry_worker("BALANCER", worker, r->server);
+        if (!PROXY_WORKER_IS_USABLE(*worker)) {
+            ap_proxy_retry_worker("BALANCER", *worker, r->server);
         }
 
-        if (PROXY_WORKER_IS_USABLE(worker)) {
-            server->worker = worker;
+        if (PROXY_WORKER_IS_USABLE(*worker)) {
+            server->worker = *worker;
             if (server->seen < LBM_HEARTBEAT_MAX_LASTSEEN) {
                 openslots += server->ready;
                 APR_ARRAY_PUSH(up_servers, hb_server_t *) = server;

Modified: httpd/httpd/trunk/modules/proxy/examples/mod_lbmethod_rr.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/examples/mod_lbmethod_rr.c?rev=771940&r1=771939&r2=771940&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/examples/mod_lbmethod_rr.c (original)
+++ httpd/httpd/trunk/modules/proxy/examples/mod_lbmethod_rr.c Tue May  5 17:15:48 2009
@@ -43,7 +43,7 @@
                                          request_rec *r)
 {
     int i;
-    proxy_worker *worker;
+    proxy_worker **worker;
     proxy_worker *mycandidate = NULL;
     int checking_standby;
     int checked_standby;
@@ -70,17 +70,17 @@
 
     checking_standby = checked_standby = 0;
     while (!mycandidate && !checked_standby) {
-        worker = (proxy_worker *)balancer->workers->elts;
+        worker = (proxy_worker **)balancer->workers->elts;
 
         for (i = 0; i < balancer->workers->nelts; i++, worker++) {
             if (i < ctx->index)
                 continue;
-            if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(worker) : PROXY_WORKER_IS_STANDBY(worker))
)
+            if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(*worker) : PROXY_WORKER_IS_STANDBY(*worker))
)
                 continue;
-            if (!PROXY_WORKER_IS_USABLE(worker))
-                ap_proxy_retry_worker("BALANCER", worker, r->server);
-            if (PROXY_WORKER_IS_USABLE(worker)) {
-                mycandidate = worker;
+            if (!PROXY_WORKER_IS_USABLE(*worker))
+                ap_proxy_retry_worker("BALANCER", *worker, r->server);
+            if (PROXY_WORKER_IS_USABLE(*worker)) {
+                mycandidate = *worker;
                 break;
             }
         }

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.c?rev=771940&r1=771939&r2=771940&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Tue May  5 17:15:48 2009
@@ -1591,13 +1591,6 @@
 
     psf->req = flag;
     psf->req_set = 1;
-
-    if (flag && !psf->forward) {
-        psf->forward = ap_proxy_create_worker(parms->pool);
-        psf->forward->name     = "proxy:forward";
-        psf->forward->hostname = "*";
-        psf->forward->scheme   = "*";
-    }
     return NULL;
 }
 
@@ -1821,7 +1814,7 @@
             return apr_pstrcat(cmd->temp_pool, "BalancerMember ", err, NULL);
     }
     /* Add the worker to the load balancer */
-    ap_proxy_add_worker_to_balancer(cmd->pool, balancer, worker);
+    ap_proxy_add_worker_to_balancer(cmd->pool, balancer, &worker);
     return NULL;
 }
 
@@ -2203,7 +2196,7 @@
     proxy_server_conf *conf = (proxy_server_conf *)
         ap_get_module_config(sconf, &proxy_module);
     proxy_balancer *balancer = NULL;
-    proxy_worker *worker = NULL;
+    proxy_worker **worker = NULL;
 
     if (flags & AP_STATUS_SHORT || conf->balancers->nelts == 0 ||
         conf->proxy_status == status_off)
@@ -2239,27 +2232,27 @@
                  "<th>F</th><th>Set</th><th>Acc</th><th>Wr</th><th>Rd</th>"
                  "</tr>\n", r);
 
-        worker = (proxy_worker *)balancer->workers->elts;
+        worker = (proxy_worker **)balancer->workers->elts;
         for (n = 0; n < balancer->workers->nelts; n++) {
             char fbuf[50];
-            ap_rvputs(r, "<tr>\n<td>", worker->scheme, "</td>", NULL);
-            ap_rvputs(r, "<td>", worker->hostname, "</td><td>", NULL);
-            if (worker->s->status & PROXY_WORKER_DISABLED)
+            ap_rvputs(r, "<tr>\n<td>", (*worker)->scheme, "</td>", NULL);
+            ap_rvputs(r, "<td>", (*worker)->hostname, "</td><td>", NULL);
+            if ((*worker)->s->status & PROXY_WORKER_DISABLED)
                 ap_rputs("Dis", r);
-            else if (worker->s->status & PROXY_WORKER_IN_ERROR)
+            else if ((*worker)->s->status & PROXY_WORKER_IN_ERROR)
                 ap_rputs("Err", r);
-            else if (worker->s->status & PROXY_WORKER_INITIALIZED)
+            else if ((*worker)->s->status & PROXY_WORKER_INITIALIZED)
                 ap_rputs("Ok", r);
             else
                 ap_rputs("-", r);
-            ap_rvputs(r, "</td><td>", worker->s->route, NULL);
-            ap_rvputs(r, "</td><td>", worker->s->redirect, NULL);
-            ap_rprintf(r, "</td><td>%d</td>", worker->s->lbfactor);
-            ap_rprintf(r, "<td>%d</td>", worker->s->lbset);
-            ap_rprintf(r, "<td>%" APR_SIZE_T_FMT "</td><td>", worker->s->elected);
-            ap_rputs(apr_strfsize(worker->s->transferred, fbuf), r);
+            ap_rvputs(r, "</td><td>", (*worker)->s->route, NULL);
+            ap_rvputs(r, "</td><td>", (*worker)->s->redirect, NULL);
+            ap_rprintf(r, "</td><td>%d</td>", (*worker)->s->lbfactor);
+            ap_rprintf(r, "<td>%d</td>", (*worker)->s->lbset);
+            ap_rprintf(r, "<td>%" APR_SIZE_T_FMT "</td><td>", (*worker)->s->elected);
+            ap_rputs(apr_strfsize((*worker)->s->transferred, fbuf), r);
             ap_rputs("</td><td>", r);
-            ap_rputs(apr_strfsize(worker->s->read, fbuf), r);
+            ap_rputs(apr_strfsize((*worker)->s->read, fbuf), r);
             ap_rputs("</td>\n", r);
 
             /* TODO: Add the rest of dynamic worker data */
@@ -2305,8 +2298,12 @@
             ap_proxy_initialize_worker(worker, s);
             worker++;
         }
-        /* Initialize forward worker if defined */
-        if (conf->forward) {
+        /* Create and initialize forward worker if defined */
+        if (conf->req_set && conf->req) {
+            conf->forward = ap_proxy_create_worker(p);
+            conf->forward->name     = "proxy:forward";
+            conf->forward->hostname = "*";
+            conf->forward->scheme   = "*";
             ap_proxy_initialize_worker_share(conf, conf->forward, s);
             ap_proxy_initialize_worker(conf->forward, s);
             /* Do not disable worker in case of errors */
@@ -2354,7 +2351,7 @@
      * make sure that we are called after the mpm
      * initializes.
      */
-    static const char *const aszPred[] = { "mpm_winnt.c", NULL};
+    static const char *const aszPred[] = { "mpm_winnt.c", "mod_proxy_balancer.c", NULL};
 
     APR_REGISTER_OPTIONAL_FN(ap_proxy_lb_workers);
     APR_REGISTER_OPTIONAL_FN(ap_proxy_lb_worker_size);

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.h?rev=771940&r1=771939&r2=771940&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.h (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.h Tue May  5 17:15:48 2009
@@ -601,12 +601,12 @@
  * Add the worker to the balancer
  * @param pool     memory pool for adding worker 
  * @param balancer balancer to add to
- * @param balancer worker to add
+ * @param address of balancer worker to add
  * @note Single worker can be added to multiple balancers.
  */
 PROXY_DECLARE(void) ap_proxy_add_worker_to_balancer(apr_pool_t *pool,
                                                     proxy_balancer *balancer,
-                                                    proxy_worker *worker);
+                                                    proxy_worker **worker);
 /**
  * Get the most suitable worker and(or) balancer for the request
  * @param worker   worker used for processing request

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=771940&r1=771939&r2=771940&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c Tue May  5 17:15:48 2009
@@ -82,20 +82,20 @@
                                  proxy_balancer *balancer)
 {
     int i;
-    proxy_worker *workers;
+    proxy_worker **workers;
 
-    workers = (proxy_worker *)balancer->workers->elts;
+    workers = (proxy_worker **)balancer->workers->elts;
 
     for (i = 0; i < balancer->workers->nelts; i++) {
         int worker_is_initialized;
-        worker_is_initialized = PROXY_WORKER_IS_INITIALIZED(workers);
+        worker_is_initialized = PROXY_WORKER_IS_INITIALIZED(*workers);
         if (!worker_is_initialized) {
             proxy_worker_stat *slot;
             /*
              * If the worker is not initialized check whether its scoreboard
              * slot is already initialized.
              */
-            slot = (proxy_worker_stat *) ap_get_scoreboard_lb(workers->id);
+            slot = (proxy_worker_stat *) ap_get_scoreboard_lb((*workers)->id);
             if (slot) {
                 worker_is_initialized = slot->status & PROXY_WORKER_INITIALIZED;
             }
@@ -103,13 +103,13 @@
                 worker_is_initialized = 0;
             }
         }
-        ap_proxy_initialize_worker_share(conf, workers, s);
-        ap_proxy_initialize_worker(workers, s);
+        ap_proxy_initialize_worker_share(conf, *workers, s);
+        ap_proxy_initialize_worker(*workers, s);
         if (!worker_is_initialized) {
             /* Set to the original configuration */
-            workers->s->lbstatus = workers->s->lbfactor =
-            (workers->lbfactor ? workers->lbfactor : 1);
-            workers->s->lbset = workers->lbset;
+            (*workers)->s->lbstatus = (*workers)->s->lbfactor =
+            ((*workers)->lbfactor ? (*workers)->lbfactor : 1);
+            (*workers)->s->lbset = (*workers)->lbset;
         }
         ++workers;
     }
@@ -401,18 +401,18 @@
 {
     int i;
     int ok = 0;
-    proxy_worker *worker;
+    proxy_worker **worker;
 
-    worker = (proxy_worker *)balancer->workers->elts;
+    worker = (proxy_worker **)balancer->workers->elts;
     for (i = 0; i < balancer->workers->nelts; i++, worker++) {
-        if (!(worker->s->status & PROXY_WORKER_IN_ERROR)) {
+        if (!((*worker)->s->status & PROXY_WORKER_IN_ERROR)) {
             ok = 1;
             break;
         }
         else {
             /* Try if we can recover */
-            ap_proxy_retry_worker("BALANCER", worker, s);
-            if (!(worker->s->status & PROXY_WORKER_IN_ERROR)) {
+            ap_proxy_retry_worker("BALANCER", *worker, s);
+            if (!((*worker)->s->status & PROXY_WORKER_IN_ERROR)) {
                 ok = 1;
                 break;
             }
@@ -421,13 +421,13 @@
     if (!ok) {
         /* If all workers are in error state force the recovery.
          */
-        worker = (proxy_worker *)balancer->workers->elts;
+        worker = (proxy_worker **)balancer->workers->elts;
         for (i = 0; i < balancer->workers->nelts; i++, worker++) {
-            ++worker->s->retries;
-            worker->s->status &= ~PROXY_WORKER_IN_ERROR;
+            ++(*worker)->s->retries;
+            (*worker)->s->status &= ~PROXY_WORKER_IN_ERROR;
             ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
                          "proxy: BALANCER: (%s). Forcing recovery for worker (%s)",
-                         balancer->name, worker->hostname);
+                         balancer->name, (*worker)->hostname);
         }
     }
 }
@@ -955,7 +955,7 @@
      * make sure that we are called after the mpm
      * initializes and after the mod_proxy
      */
-    static const char *const aszPred[] = { "mpm_winnt.c", "mod_proxy.c", NULL};
+    static const char *const aszPred[] = { "mpm_winnt.c", NULL};
      /* manager handler */
     ap_hook_post_config(balancer_init, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_handler(balancer_handler, NULL, NULL, APR_HOOK_FIRST);

Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=771940&r1=771939&r2=771940&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Tue May  5 17:15:48 2009
@@ -1081,7 +1081,7 @@
         if ((strncasecmp(real, "balancer://", 11) == 0) &&
             (balancer = ap_proxy_get_balancer(r->pool, sconf, real))) {
             int n, l3 = 0;
-            proxy_worker *worker = (proxy_worker *)balancer->workers->elts;
+            proxy_worker **worker = (proxy_worker **)balancer->workers->elts;
             const char *urlpart = ap_strchr_c(real + 11, '/');
             if (urlpart) {
                 if (!urlpart[1])
@@ -1095,20 +1095,20 @@
              * translate url http://example.com/foo/bar/that to /bash/that
              */
             for (n = 0; n < balancer->workers->nelts; n++) {
-                l2 = strlen(worker->name);
+                l2 = strlen((*worker)->name);
                 if (urlpart) {
                     /* urlpart (l3) assuredly starts with its own '/' */
-                    if (worker->name[l2 - 1] == '/')
+                    if ((*worker)->name[l2 - 1] == '/')
                         --l2;
                     if (l1 >= l2 + l3 
-                            && strncasecmp(worker->name, url, l2) == 0
+                            && strncasecmp((*worker)->name, url, l2) == 0
                             && strncmp(urlpart, url + l2, l3) == 0) {
                         u = apr_pstrcat(r->pool, ent[i].fake, &url[l2 + l3],
                                         NULL);
                         return ap_construct_url(r->pool, u, r);
                     }
                 }
-                else if (l1 >= l2 && strncasecmp(worker->name, url, l2) ==
0) {
+                else if (l1 >= l2 && strncasecmp((*worker)->name, url, l2)
== 0) {
                     u = apr_pstrcat(r->pool, ent[i].fake, &url[l2], NULL);
                     return ap_construct_url(r->pool, u, r);
                 }
@@ -1303,7 +1303,7 @@
 
     (*balancer)->name = uri;
     (*balancer)->lbmethod = lbmethod;
-    (*balancer)->workers = apr_array_make(p, 5, sizeof(proxy_worker));
+    (*balancer)->workers = apr_array_make(p, 5, sizeof(proxy_worker *));
     /* XXX Is this a right place to create mutex */
 #if APR_HAS_THREADS
     if (apr_thread_mutex_create(&((*balancer)->mutex),
@@ -1471,13 +1471,13 @@
 
 PROXY_DECLARE(void)
 ap_proxy_add_worker_to_balancer(apr_pool_t *pool, proxy_balancer *balancer,
-                                proxy_worker *worker)
+                                proxy_worker **worker)
 {
-    proxy_worker *runtime;
+    proxy_worker **runtime;
 
     runtime = apr_array_push(balancer->workers);
-    memcpy(runtime, worker, sizeof(proxy_worker));
-    runtime->id = proxy_lb_workers;
+    memcpy(runtime, worker, sizeof(proxy_worker *));
+    (*runtime)->id = proxy_lb_workers;
     /* Increase the total runtime count */
     proxy_lb_workers++;
 



Mime
View raw message