]> granicus.if.org Git - apache/commitdiff
Add status param option so that current worker
authorMladen Turk <mturk@apache.org>
Thu, 28 Jul 2005 11:16:34 +0000 (11:16 +0000)
committerMladen Turk <mturk@apache.org>
Thu, 28 Jul 2005 11:16:34 +0000 (11:16 +0000)
status can be changed via editing httpd.conf instead
just using web page. Seems the ApacheCon is paying of.
Thanks to Sander for pointing that out.

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

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

index 2fd69f8ac897d5f357fdb04791c60bb98c792bca..8b38bb1f5cdb67279fd0e862f15c4d1d7530f51f 100644 (file)
@@ -181,6 +181,43 @@ static const char *set_worker_param(apr_pool_t *p,
             return "Redirect length must be < 64 characters";
         worker->redirect = apr_pstrdup(p, val);
     }
+    else if (!strcasecmp(key, "status")) {
+        const char *v;
+        int mode = 1;
+        /* Worker status.
+         */
+        for (v = val; *v; v++) {
+            if (*v == '+') {
+                mode = 1;
+                v++;    
+            }
+            else if (*v == '-') {
+                mode = 0;
+                v++;    
+            }
+            if (*v == 'D' || *v == 'd') {
+                if (mode)
+                    worker->status |= PROXY_WORKER_DISABLED;
+                else
+                    worker->status &= ~PROXY_WORKER_DISABLED;                    
+            }
+            else if (*v == 'S' || *v == 's') {
+                if (mode)
+                    worker->status |= PROXY_WORKER_STOPPED;
+                else
+                    worker->status &= ~PROXY_WORKER_STOPPED;                    
+            }
+            else if (*v == 'E' || *v == 'e') {
+                if (mode)
+                    worker->status |= PROXY_WORKER_IN_ERROR;
+                else
+                    worker->status &= ~PROXY_WORKER_IN_ERROR;                    
+            }
+            else {
+                return "Unknow status parameter option";    
+            }
+        }
+    }    
     else {
         return "unknown Worker parameter";
     }
index 5f8ec9511a68d34da5d243ffec630f9672155886..73afeb59f7829e21fde2942a2973e50374363d06 100644 (file)
@@ -228,7 +228,8 @@ struct proxy_conn_pool {
 #define PROXY_WORKER_IGNORE_ERRORS  0x0002
 #define PROXY_WORKER_IN_SHUTDOWN    0x0010
 #define PROXY_WORKER_DISABLED       0x0020
-#define PROXY_WORKER_IN_ERROR       0x0040
+#define PROXY_WORKER_STOPPED        0x0040
+#define PROXY_WORKER_IN_ERROR       0x0080
 
 #define PROXY_WORKER_IS_USABLE(f)   (!((f)->s->status & 0x00F0))
 
@@ -260,6 +261,7 @@ struct proxy_worker {
     const char      *hostname;  /* remote backend address */
     const char      *route;     /* balancing route */
     const char      *redirect;  /* temporary balancing redirection route */
+    int             status;     /* temporary worker status */
     apr_port_t      port;
     int             min;        /* Desired minimum number of available connections */
     int             smax;       /* Soft maximum on the total number of connections */
index 86335b44ac35f48158352038a62a8a88e45d8537..8789cc6fe291fbd50e1e59952f6cc8589633d999 100644 (file)
@@ -1620,7 +1620,7 @@ PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker, ser
              worker->id, getpid(), worker->hostname);
     }
     if (rv == APR_SUCCESS)
-        worker->s->status |= PROXY_WORKER_INITIALIZED;
+        worker->s->status |= (worker->status | PROXY_WORKER_INITIALIZED);
     return rv;
 }