]> granicus.if.org Git - apache/commitdiff
Some fixes before we move this to an example's dir, but
authorJim Jagielski <jim@apache.org>
Wed, 14 Nov 2007 16:25:00 +0000 (16:25 +0000)
committerJim Jagielski <jim@apache.org>
Wed, 14 Nov 2007 16:25:00 +0000 (16:25 +0000)
remove the unneeded CORE_PRIVATE and bypass inf loop,
but *still* this is not intended to be a module to
*use* but rather as an example that yes, you can add
lbmethods via sub-module prvider.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@594931 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_lbmethod_rr.c

index 7fca58190f914682d8de77ea7a32cb7391710aeb..b7f4f0f0ad2215a9b72d90b5c2e5c673eeaae3b0 100644 (file)
  * limitations under the License.
  */
 
-/* Round Robin lbmethod module for Apache proxy */
+/* Round Robin lbmethod EXAMPLE module for Apache proxy */
 
 /* NOTE: This is designed simply to provide some info on how to create
          extra lbmethods via sub-modules... This code is ugly
          and needs work to actually do round-robin "right"
          but that is left as an exercise for the reader */
 
-#define CORE_PRIVATE
-
 #include "mod_proxy.h"
 #include "scoreboard.h"
 #include "ap_mpm.h"
@@ -70,26 +68,25 @@ static proxy_worker *find_best_roundrobin(proxy_balancer *balancer,
                  "proxy: roundrobin index: %d (%d)",
                  ctx->index, (int)getpid());
 
-    do {
-        checking_standby = checked_standby = 0;
-        while (!mycandidate && !checked_standby) {
-            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)) )
-                    continue;
-                if (!PROXY_WORKER_IS_USABLE(worker))
-                    ap_proxy_retry_worker("BALANCER", worker, r->server);
-                if (PROXY_WORKER_IS_USABLE(worker)) {
-                    mycandidate = worker;
-                    break;
-                }
+    checking_standby = checked_standby = 0;
+    while (!mycandidate && !checked_standby) {
+        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)) )
+                continue;
+            if (!PROXY_WORKER_IS_USABLE(worker))
+                ap_proxy_retry_worker("BALANCER", worker, r->server);
+            if (PROXY_WORKER_IS_USABLE(worker)) {
+                mycandidate = worker;
+                break;
             }
-            checked_standby = checking_standby++;
         }
-    } while (!mycandidate);
+        checked_standby = checking_standby++;
+    }
+
 
     ctx->index += 1;
     if (ctx->index >= balancer->workers->nelts) {