]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Clean up some proxy macros. Avoid the use of magic
authorJim Jagielski <jim@apache.org>
Tue, 11 Jul 2006 19:32:36 +0000 (19:32 +0000)
committerJim Jagielski <jim@apache.org>
Tue, 11 Jul 2006 19:32:36 +0000 (19:32 +0000)
numbers, and instead use pre-defined defines. Also,
ensure that usable workers have been initialized :)

Allocate a bit for hot standbys. Adjust so that
normal "usable" workers don't count these.

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

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

index 57a7076b35886c1b2b60b593c124c72b262f00b7..a938586ece677ee5a36ffbf490c918ef39acfa3f 100644 (file)
@@ -241,15 +241,34 @@ struct proxy_conn_pool {
     proxy_conn_rec *conn;   /* Single connection for prefork mpm's */
 };
 
-/* woker status flags */
+/* worker status flags */
 #define PROXY_WORKER_INITIALIZED    0x0001
 #define PROXY_WORKER_IGNORE_ERRORS  0x0002
 #define PROXY_WORKER_IN_SHUTDOWN    0x0010
 #define PROXY_WORKER_DISABLED       0x0020
 #define PROXY_WORKER_STOPPED        0x0040
 #define PROXY_WORKER_IN_ERROR       0x0080
+#define PROXY_WORKER_HOT_STANDBY    0x0100
 
-#define PROXY_WORKER_IS_USABLE(f)   (!((f)->s->status & 0x00F0))
+#define PROXY_WORKER_NOT_USABLE_BITMAP ( PROXY_WORKER_IN_SHUTDOWN | \
+PROXY_WORKER_DISABLED | PROXY_WORKER_STOPPED | PROXY_WORKER_IN_ERROR )
+
+#define PROXY_WORKER_IS_INITIALIZED(f)   ( (f)->s->status & \
+  PROXY_WORKER_INITIALIZED )
+
+#define PROXY_WORKER_IS_STANDBY(f)   ( (f)->s->status & \
+  PROXY_WORKER_HOT_STANDBY )
+
+#define PROXY_WORKER_IS_USABLE(f)   ( !((f)->s->status & \
+  (PROXY_WORKER_NOT_USABLE_BITMAP | PROXY_WORKER_HOT_STANDBY )) && \
+  PROXY_WORKER_IS_INITIALIZED(f) )
+
+#define PROXY_WORKER_IS_USABLE_STANDBY(f)   ( !((f)->s->status & \
+  PROXY_WORKER_NOT_USABLE_BITMAP) && PROXY_WORKER_IS_STANDBY(f) && \
+  PROXY_WORKER_IS_INITIALIZED(f) )
+
+#define PROXY_WORKER_IS_USABLE_DC(f)   ( !((f)->s->status & \
+  (PROXY_WORKER_NOT_USABLE_BITMAP)) && PROXY_WORKER_IS_INITIALIZED(f) )
 
 /* default worker retry timeout in seconds */
 #define PROXY_WORKER_DEFAULT_RETRY  60
index d83d22bdfec830cd04ddf993e2293df38b206cbf..93340bbe3f82b808caf8f631edf379a59f810e53 100644 (file)
@@ -1605,7 +1605,7 @@ PROXY_DECLARE(void) ap_proxy_initialize_worker_share(proxy_server_conf *conf,
     void *score = NULL;
 #endif
 
-    if (worker->s && (worker->s->status & PROXY_WORKER_INITIALIZED)) {
+    if (worker->s && PROXY_WORKER_IS_INITIALIZED(worker)) {
         /* The worker share is already initialized */
         ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
               "proxy: worker %s already initialized",
@@ -1639,7 +1639,7 @@ PROXY_DECLARE(void) ap_proxy_initialize_worker_share(proxy_server_conf *conf,
      * recheck to see if we've already been here. Possible
      * if proxy is using scoreboard to hold shared stats
      */
-    if (worker->s->status & PROXY_WORKER_INITIALIZED) {
+    if (PROXY_WORKER_IS_INITIALIZED(worker)) {
         /* The worker share is already initialized */
         ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
               "proxy: worker %s already initialized",
@@ -1667,7 +1667,7 @@ PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker, ser
     int mpm_threads;
 #endif
 
-    if (worker->status & PROXY_WORKER_INITIALIZED) {
+    if (PROXY_WORKER_IS_INITIALIZED(worker)) {
         /* The worker is already initialized */
         return APR_SUCCESS;
     }