httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r420954 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.h proxy_util.c
Date Tue, 11 Jul 2006 19:32:37 GMT
Author: jim
Date: Tue Jul 11 12:32:36 2006
New Revision: 420954

URL: http://svn.apache.org/viewvc?rev=420954&view=rev
Log:
Clean up some proxy macros. Avoid the use of magic
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.

Modified:
    httpd/httpd/trunk/modules/proxy/mod_proxy.h
    httpd/httpd/trunk/modules/proxy/proxy_util.c

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.h?rev=420954&r1=420953&r2=420954&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.h (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.h Tue Jul 11 12:32:36 2006
@@ -241,15 +241,34 @@
     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

Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=420954&r1=420953&r2=420954&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Tue Jul 11 12:32:36 2006
@@ -1605,7 +1605,7 @@
     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 @@
      * 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 @@
     int mpm_threads;
 #endif
 
-    if (worker->status & PROXY_WORKER_INITIALIZED) {
+    if (PROXY_WORKER_IS_INITIALIZED(worker)) {
         /* The worker is already initialized */
         return APR_SUCCESS;
     }



Mime
View raw message