You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by rj...@apache.org on 2008/01/06 22:01:20 UTC

svn commit: r609400 - /tomcat/connectors/trunk/jk/native/common/jk_shm.c

Author: rjung
Date: Sun Jan  6 13:01:19 2008
New Revision: 609400

URL: http://svn.apache.org/viewvc?rev=609400&view=rev
Log:
Minor shm cleanup.

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

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=609400&r1=609399&r2=609400&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_shm.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_shm.c Sun Jan  6 13:01:19 2008
@@ -103,21 +103,22 @@
         if (!strcmp(type, JK_LB_WORKER_NAME)) {
             char **member_list;
             unsigned num_of_members;
+            num_of_shm_workers++;
             if (jk_get_lb_worker_list(init_data, worker_list[i],
                                       &member_list, &num_of_members) == JK_FALSE) {
                 jk_log(l, JK_LOG_ERROR,
                        "Could not get member list for lb worker from map");
-                JK_TRACE_EXIT(l);
-                return 0;
             }
-            if (JK_IS_DEBUG_LEVEL(l))
-                jk_log(l, JK_LOG_DEBUG, "worker %s of type %s has %u members",
-                       worker_list[i], JK_LB_WORKER_NAME, num_of_members);
-            num_of_shm_workers += num_of_members + 1;
+            else {
+                if (JK_IS_DEBUG_LEVEL(l))
+                    jk_log(l, JK_LOG_DEBUG, "worker %s of type %s has %u members",
+                           worker_list[i], JK_LB_WORKER_NAME, num_of_members);
+                num_of_shm_workers += num_of_members;
+            }
         }
     }
     if (JK_IS_DEBUG_LEVEL(l))
-        jk_log(l, JK_LOG_DEBUG, "shared memory will contain %u items", num_of_shm_workers);
+        jk_log(l, JK_LOG_DEBUG, "shared memory will contain %d items", num_of_shm_workers);
     jk_shmem.workers = num_of_shm_workers;
     JK_TRACE_EXIT(l);
     return JK_SHM_SIZE(jk_shmem.workers);
@@ -635,7 +636,7 @@
     void *rc = NULL;
 
     if (jk_shmem.hdr) {
-        size = JK_ALIGN_DEFAULT(size);
+        size = JK_SHM_ALIGN(size);
         if ((jk_shmem.hdr->h.data.size - jk_shmem.hdr->h.data.pos) >= size) {
             rc = &(jk_shmem.hdr->buf[jk_shmem.hdr->h.data.pos]);
             jk_shmem.hdr->h.data.pos += size;
@@ -706,9 +707,9 @@
 
 jk_shm_worker_t *jk_shm_alloc_worker(jk_pool_t *p)
 {
-    jk_shm_worker_t *w = (jk_shm_worker_t *)jk_shm_alloc(p, sizeof(jk_shm_worker_t));
+    jk_shm_worker_t *w = (jk_shm_worker_t *)jk_shm_alloc(p, JK_SHM_WORKER_SIZE);
     if (w) {
-        memset(w, 0, sizeof(jk_shm_worker_t));
+        memset(w, 0, JK_SHM_WORKER_SIZE);
         if (jk_shmem.hdr) {
             jk_shmem.hdr->h.data.workers++;
             w->id = jk_shmem.hdr->h.data.workers;



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