tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r749457 - /tomcat/connectors/trunk/jk/native/common/jk_status.c
Date Mon, 02 Mar 2009 22:26:46 GMT
Author: rjung
Date: Mon Mar  2 22:26:46 2009
New Revision: 749457

URL: http://svn.apache.org/viewvc?rev=749457&view=rev
Log:
commit_member() in status worker now returns
JK_TRUE/JK_FALSE. The additional information about
needed push etc. is returned via side effect argument.
We need this in order to be able to escalate
errors from commit_member to the calling functions.

Modified:
    tomcat/connectors/trunk/jk/native/common/jk_status.c

Modified: tomcat/connectors/trunk/jk/native/common/jk_status.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_status.c?rev=749457&r1=749456&r2=749457&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_status.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_status.c Mon Mar  2 22:26:46 2009
@@ -3079,12 +3079,13 @@
                          lb_worker_t *lb,
                          lb_sub_worker_t *wr,
                          ajp_worker_t *aw,
+                         int *side_effect,
                          jk_logger_t *l)
 {
     const char *arg;
     const char *lb_name = NULL;
     status_worker_t *w = p->worker;
-    int rc = 0;
+    int rc = JK_TRUE;
     int rv;
     int i;
     int old;
@@ -3115,13 +3116,13 @@
                 jk_log(l, JK_LOG_INFO,
                        "Status worker '%s' setting 'activation' for sub worker '%s' of lb
worker '%s' to '%s'",
                        w->name, wr->name, lb_name, jk_lb_get_activation(wr, l));
-                rc |= JK_STATUS_NEEDS_RESET_LB_VALUES | JK_STATUS_NEEDS_PUSH;
+                *side_effect |= JK_STATUS_NEEDS_RESET_LB_VALUES | JK_STATUS_NEEDS_PUSH;
             }
         }
         if (set_int_if_changed(p, wr->name, "lbfactor", JK_STATUS_ARG_LBM_FACTOR,
                                1, INT_MAX, &wr->lb_factor, lb_name, l))
             /* Recalculate the load multiplicators wrt. lb_factor */
-            rc |= JK_STATUS_NEEDS_UPDATE_MULT | JK_STATUS_NEEDS_PUSH;
+            *side_effect |= JK_STATUS_NEEDS_UPDATE_MULT | JK_STATUS_NEEDS_PUSH;
         if ((rv = status_get_string(p, JK_STATUS_ARG_LBM_ROUTE,
                                     NULL, &arg, l)) == JK_TRUE) {
             if (strncmp(wr->route, arg, JK_SHM_STR_SIZ)) {
@@ -3129,7 +3130,7 @@
                        "Status worker '%s' setting 'route' for sub worker '%s' of lb worker
'%s' to '%s'",
                        w->name, wr->name, lb_name, arg);
                 strncpy(wr->route, arg, JK_SHM_STR_SIZ);
-                rc |= JK_STATUS_NEEDS_PUSH;
+                *side_effect |= JK_STATUS_NEEDS_PUSH;
                 if (!wr->domain[0]) {
                     char * id_domain = strchr(wr->route, '.');
                     if (id_domain) {
@@ -3147,7 +3148,7 @@
                        "Status worker '%s' setting 'redirect' for sub worker '%s' of lb worker
'%s' to '%s'",
                        w->name, wr->name, lb_name, arg);
                 strncpy(wr->redirect, arg, JK_SHM_STR_SIZ);
-                rc |= JK_STATUS_NEEDS_PUSH;
+                *side_effect |= JK_STATUS_NEEDS_PUSH;
             }
         }
         if ((rv = status_get_string(p, JK_STATUS_ARG_LBM_DOMAIN,
@@ -3157,17 +3158,17 @@
                        "Status worker '%s' setting 'domain' for sub worker '%s' of lb worker
'%s' to '%s'",
                        w->name, wr->name, lb_name, arg);
                 strncpy(wr->domain, arg, JK_SHM_STR_SIZ);
-                rc |= JK_STATUS_NEEDS_PUSH;
+                *side_effect |= JK_STATUS_NEEDS_PUSH;
             }
         }
         if (set_int_if_changed(p, wr->name, "distance", JK_STATUS_ARG_LBM_DISTANCE,
                                0, INT_MAX, &wr->distance, lb_name, l))
-            rc |= JK_STATUS_NEEDS_PUSH;
+            *side_effect |= JK_STATUS_NEEDS_PUSH;
     }
     old = aw->cache_timeout;
     if (set_int_if_changed(p, aw->name, "connection_pool_timeout", JK_STATUS_ARG_AJP_CACHE_TO,
                            0, INT_MAX, &aw->cache_timeout, lb_name, l)) {
-        rc |= JK_STATUS_NEEDS_PUSH;
+        *side_effect |= JK_STATUS_NEEDS_PUSH;
         if (old == 0) {
             unsigned int i;
             for (i = 0; i < aw->ep_cache_sz; i++) {
@@ -3184,14 +3185,14 @@
                     "Status worker '%s' setting 'host' for sub worker '%s' to '%s'",
                     w->name, aw->name, arg);
             strncpy(host, arg, JK_SHM_STR_SIZ);
-            rc |= JK_STATUS_NEEDS_PUSH;
+            *side_effect |= JK_STATUS_NEEDS_PUSH;
             as = 1;
         }
     }
     port = aw->s->port;
     if (set_int_if_changed(p, aw->name, "port", JK_STATUS_ARG_AJP_PORT_INT,
                            0, INT_MAX, &port, lb_name, l)) {
-        rc |= JK_STATUS_NEEDS_PUSH;
+        *side_effect |= JK_STATUS_NEEDS_PUSH;
         as = 1;
     }
     if (as) {
@@ -3202,6 +3203,7 @@
             jk_log(l, JK_LOG_ERROR,
                    "Status worker '%s' failed resolving 'address' for sub worker '%s' to
'%s:%d'",
                    w->name, aw->name, host, port);
+            rc = JK_FALSE;
         }
         else {
             strcpy(aw->s->host, host);
@@ -3214,31 +3216,31 @@
     }
     if (set_int_if_changed(p, aw->name, "ping_timeout", JK_STATUS_ARG_AJP_PING_TO,
                            0, INT_MAX, &aw->ping_timeout, lb_name, l))
-        rc |= JK_STATUS_NEEDS_PUSH;
+        *side_effect |= JK_STATUS_NEEDS_PUSH;
     if (set_int_if_changed(p, aw->name, "connect_timeout", JK_STATUS_ARG_AJP_CONNECT_TO,
                            0, INT_MAX, &aw->connect_timeout, lb_name, l))
-        rc |= JK_STATUS_NEEDS_PUSH;
+        *side_effect |= JK_STATUS_NEEDS_PUSH;
     if (set_int_if_changed(p, aw->name, "prepost_timeout", JK_STATUS_ARG_AJP_PREPOST_TO,
                            0, INT_MAX, &aw->prepost_timeout, lb_name, l))
-        rc |= JK_STATUS_NEEDS_PUSH;
+        *side_effect |= JK_STATUS_NEEDS_PUSH;
     if (set_int_if_changed(p, aw->name, "reply_timeout", JK_STATUS_ARG_AJP_REPLY_TO,
                            0, INT_MAX, &aw->reply_timeout, lb_name, l))
-        rc |= JK_STATUS_NEEDS_PUSH;
+        *side_effect |= JK_STATUS_NEEDS_PUSH;
     if (set_int_if_changed(p, aw->name, "retries", JK_STATUS_ARG_AJP_RETRIES,
                            1, INT_MAX, &aw->retries, lb_name, l))
-        rc |= JK_STATUS_NEEDS_PUSH;
+        *side_effect |= JK_STATUS_NEEDS_PUSH;
     if (set_int_if_changed(p, aw->name, "retry_interval", JK_STATUS_ARG_AJP_RETRY_INT,
                            1, INT_MAX, &aw->retry_interval, lb_name, l))
-        rc |= JK_STATUS_NEEDS_PUSH;
+        *side_effect |= JK_STATUS_NEEDS_PUSH;
     if (set_int_if_changed(p, aw->name, "connection_ping_interval", JK_STATUS_ARG_AJP_CPING_INT,
                            1, INT_MAX, &aw->conn_ping_interval, lb_name, l))
-        rc |= JK_STATUS_NEEDS_PUSH;
+        *side_effect |= JK_STATUS_NEEDS_PUSH;
     if (set_uint_if_changed(p, aw->name, "recovery_options", JK_STATUS_ARG_AJP_REC_OPTS,
                            0, INT_MAX, &aw->recovery_opts, lb_name, l))
-        rc |= JK_STATUS_NEEDS_PUSH;
+        *side_effect |= JK_STATUS_NEEDS_PUSH;
     if (set_uint_if_changed(p, aw->name, "max_packet_size", JK_STATUS_ARG_AJP_MAX_PK_SZ,
                            8*1024, 64*1024, &aw->max_packet_size, lb_name, l)) {
-        rc |= JK_STATUS_NEEDS_PUSH;
+        *side_effect |= JK_STATUS_NEEDS_PUSH;
         if (aw->max_packet_size > lb->max_packet_size) {
             lb->max_packet_size = aw->max_packet_size;
         }
@@ -3896,7 +3898,8 @@
     lb_worker_t *lb = NULL;
     lb_sub_worker_t *wr = NULL;
     ajp_worker_t *aw = NULL;
-    int rc;
+    int rc = JK_TRUE;
+    int rv;
 
     JK_TRACE_ENTER(l);
     fetch_worker_and_sub_worker(p, "updating", &worker, &sub_worker, l);
@@ -3958,22 +3961,22 @@
                        "Status worker '%s' %s lb worker '%s' sub worker '%s'",
                        w->name, "updating", lb->name, wr->name);
                 aw = (ajp_worker_t *)wr->worker->worker_private;
-                rc = commit_member(s, p, lb, wr, aw, l);
-                if (rc & JK_STATUS_NEEDS_PUSH) {
+                rc = commit_member(s, p, lb, wr, aw, &rv, l);
+                if (rv & JK_STATUS_NEEDS_PUSH) {
                     wr->sequence++;
                     lb->sequence++;
                     jk_lb_push(lb, l);
                 }
-                if (rc & JK_STATUS_NEEDS_RESET_LB_VALUES)
+                if (rv & JK_STATUS_NEEDS_RESET_LB_VALUES)
                     reset_lb_values(lb, l);
-                if (rc & JK_STATUS_NEEDS_UPDATE_MULT)
+                if (rv & JK_STATUS_NEEDS_UPDATE_MULT)
                     /* Recalculate the load multiplicators wrt. lb_factor */
                     update_mult(lb, l);
-                if (!wi)
+                if (!wi || (rc == JK_FALSE))
                     break;
             }
             JK_TRACE_EXIT(l);
-            return JK_TRUE;
+            return rc;
         }
     }
     else if (jw->type == JK_AJP13_WORKER_TYPE ||
@@ -3986,12 +3989,13 @@
                        w->name, "updating", aw->name);
             if (aw->sequence != aw->s->h.sequence)
                 jk_ajp_pull(aw, l);
-            if (commit_member(s, p, NULL, NULL, aw, l) & JK_STATUS_NEEDS_PUSH) {
+            rc = commit_member(s, p, NULL, NULL, aw, &rv, l);
+            if (rv & JK_STATUS_NEEDS_PUSH) {
                 aw->sequence++;
                 jk_ajp_push(aw, l);
             }
             JK_TRACE_EXIT(l);
-            return JK_TRUE;
+            return rc;
         }
         else {
             jk_log(l, JK_LOG_WARNING,



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message