tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r611594 - in /tomcat/connectors/trunk/jk/native/common: jk_lb_worker.c jk_shm.c jk_shm.h jk_status.c
Date Sun, 13 Jan 2008 16:30:02 GMT
Author: rjung
Date: Sun Jan 13 08:30:01 2008
New Revision: 611594

URL: http://svn.apache.org/viewvc?rev=611594&view=rev
Log:
Move common shm worker elements into separate
header struct.

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

Modified: tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c?rev=611594&r1=611593&r2=611594&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c Sun Jan 13 08:30:01 2008
@@ -281,11 +281,11 @@
     p->retries = p->s->retries;
     p->lbmethod = p->s->lbmethod;
     p->lblock = p->s->lblock;
-    p->sequence = p->s->sequence;
+    p->sequence = p->s->h.sequence;
 
     for (i = 0; i < p->num_of_workers; i++) {
         worker_record_t *w = &p->lb_workers[i];
-        if (w->sequence != w->s->sequence) {
+        if (w->sequence != w->s->h.sequence) {
             if (JK_IS_DEBUG_LEVEL(l))
                 jk_log(l, JK_LOG_DEBUG,
                        "syncing mem for member '%s' of lb '%s' from shm",
@@ -297,7 +297,7 @@
             w->activation = w->s->activation;
             w->lb_factor = w->s->lb_factor;
             w->lb_mult = w->s->lb_mult;
-            w->sequence = w->s->sequence;
+            w->sequence = w->s->h.sequence;
         }
     }
 
@@ -322,11 +322,11 @@
     p->s->retries = p->retries;
     p->s->lbmethod = p->lbmethod;
     p->s->lblock = p->lblock;
-    p->s->sequence = p->sequence;
+    p->s->h.sequence = p->sequence;
 
     for (i = 0; i < p->num_of_workers; i++) {
         worker_record_t *w = &p->lb_workers[i];
-        if (w->sequence != w->s->sequence) {
+        if (w->sequence != w->s->h.sequence) {
             if (JK_IS_DEBUG_LEVEL(l))
                 jk_log(l, JK_LOG_DEBUG,
                        "syncing shm for member '%s' of lb '%s' from mem",
@@ -338,7 +338,7 @@
             w->s->activation = w->activation;
             w->s->lb_factor = w->lb_factor;
             w->s->lb_mult = w->lb_mult;
-            w->s->sequence = w->sequence;
+            w->s->h.sequence = w->sequence;
         }
     }
 
@@ -486,7 +486,7 @@
     worker_record_t *w = NULL;
     JK_TRACE_ENTER(l);
 
-    if (p->sequence != p->s->sequence)
+    if (p->sequence != p->s->h.sequence)
         jk_lb_pull(p, l);
     for (i = 0; i < p->num_of_workers; i++) {
         w = &p->lb_workers[i];
@@ -952,7 +952,7 @@
     *is_error = JK_HTTP_OK;
 
     jk_shm_lock();
-    if (p->worker->sequence != p->worker->s->sequence)
+    if (p->worker->sequence != p->worker->s->h.sequence)
         jk_lb_pull(p->worker, l);
     jk_shm_unlock();
 
@@ -1367,10 +1367,10 @@
                 unsigned int ms;
                 strncpy(p->lb_workers[i].name, worker_names[i],
                         JK_SHM_STR_SIZ);
-                strncpy(p->lb_workers[i].s->name, worker_names[i],
+                strncpy(p->lb_workers[i].s->h.name, worker_names[i],
                         JK_SHM_STR_SIZ);
                 p->lb_workers[i].sequence = 0;
-                p->lb_workers[i].s->sequence = 0;
+                p->lb_workers[i].s->h.sequence = 0;
                 p->lb_workers[i].lb_factor =
                     jk_get_lb_factor(props, worker_names[i]);
                 if (p->lb_workers[i].lb_factor < 1) {
@@ -1576,7 +1576,7 @@
             return 0;
         }
         strncpy(private_data->name, name, JK_SHM_STR_SIZ);
-        strncpy(private_data->s->name, name, JK_SHM_STR_SIZ);
+        strncpy(private_data->s->h.name, name, JK_SHM_STR_SIZ);
         private_data->lb_workers = NULL;
         private_data->num_of_workers = 0;
         private_data->worker.worker_private = private_data;
@@ -1588,7 +1588,7 @@
         private_data->recover_wait_time = WAIT_BEFORE_RECOVER;
         private_data->max_reply_timeouts = 0;
         private_data->sequence = 0;
-        private_data->s->sequence = 0;
+        private_data->s->h.sequence = 0;
         private_data->next_offset = 0;
         *w = &private_data->worker;
         JK_TRACE_EXIT(l);

Modified: tomcat/connectors/trunk/jk/native/common/jk_shm.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_shm.c?rev=611594&r1=611593&r2=611594&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_shm.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_shm.c Sun Jan 13 08:30:01 2008
@@ -717,11 +717,11 @@
         memset(w, 0, JK_SHM_AJP13_WORKER_SIZE);
         if (jk_shmem.hdr) {
             jk_shmem.hdr->h.data.workers++;
-            w->id = jk_shmem.hdr->h.data.workers;
-            w->type = JK_AJP13_WORKER_TYPE;
+            w->h.id = jk_shmem.hdr->h.data.workers;
+            w->h.type = JK_AJP13_WORKER_TYPE;
         }
         else
-            w->id = -1;
+            w->h.id = -1;
     }
     return w;
 }
@@ -733,11 +733,11 @@
         memset(w, 0, JK_SHM_LB_WORKER_SIZE);
         if (jk_shmem.hdr) {
             jk_shmem.hdr->h.data.workers++;
-            w->id = jk_shmem.hdr->h.data.workers;
-            w->type = JK_LB_WORKER_TYPE;
+            w->h.id = jk_shmem.hdr->h.data.workers;
+            w->h.type = JK_LB_WORKER_TYPE;
         }
         else
-            w->id = -1;
+            w->h.id = -1;
     }
     return w;
 }

Modified: tomcat/connectors/trunk/jk/native/common/jk_shm.h
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_shm.h?rev=611594&r1=611593&r2=611594&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_shm.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_shm.h Sun Jan 13 08:30:01 2008
@@ -58,8 +58,8 @@
 #define JK_SHM_LB_SIZE(x)        ((x) * JK_SHM_LB_WORKER_SIZE)
 #define JK_SHM_DEF_SIZE          JK_SHM_AJP13_SIZE(JK_SHM_MAX_WORKERS)
 
-/** jk shm ajp13 worker record structure */
-struct jk_shm_ajp13_worker
+/** jk shm generic worker record structure */
+struct jk_shm_worker_header
 {
     int     id;
     int     type;
@@ -69,6 +69,14 @@
      * every time we change the config
      */
     volatile unsigned int sequence;
+};
+typedef struct jk_shm_worker_header jk_shm_worker_header_t;
+
+/** jk shm ajp13 worker record structure */
+struct jk_shm_ajp13_worker
+{
+    jk_shm_worker_header_t h;
+
     /* Number of currently busy channels */
     volatile int busy;
     /* Maximum number of busy channels */
@@ -113,14 +121,8 @@
 /** jk shm lb worker record structure */
 struct jk_shm_lb_worker
 {
-    int     id;
-    int     type;
-    /* worker name */
-    char    name[JK_SHM_STR_SIZ+1];
-    /* Sequence counter starting at 0 and increasing
-     * every time we change the config
-     */
-    volatile unsigned int sequence;
+    jk_shm_worker_header_t h;
+
     /* Number of currently busy channels */
     volatile int busy;
     /* Maximum number of busy channels */

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=611594&r1=611593&r2=611594&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_status.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_status.c Sun Jan 13 08:30:01 2008
@@ -1483,7 +1483,7 @@
     }
 
     jk_shm_lock();
-    if (lb->sequence != lb->s->sequence)
+    if (lb->sequence != lb->s->h.sequence)
         jk_lb_pull(lb, l);
     jk_shm_unlock();
 
@@ -2019,7 +2019,7 @@
     }
 
     jk_shm_lock();
-    if (lb->sequence != lb->s->sequence)
+    if (lb->sequence != lb->s->h.sequence)
         jk_lb_pull(lb, l);
     jk_shm_unlock();
 
@@ -2324,7 +2324,7 @@
         return;
     }
 
-    if (lb->sequence != lb->s->sequence)
+    if (lb->sequence != lb->s->h.sequence)
         jk_lb_pull(lb, l);
 
     i = status_get_int(p, JK_STATUS_ARG_LB_RETRIES,



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


Mime
View raw message