tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r580793 - in /tomcat/connectors/trunk/jk/native: apache-1.3/mod_jk.c apache-2.0/mod_jk.c
Date Sun, 30 Sep 2007 21:30:49 GMT
Author: rjung
Date: Sun Sep 30 14:30:49 2007
New Revision: 580793

URL: http://svn.apache.org/viewvc?rev=580793&view=rev
Log:
Remove worker_properties and worker_file from per server config.
They are global.
Do not allow multiple JkWorkerFile directives.

Modified:
    tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c
    tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c

Modified: tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c?rev=580793&r1=580792&r2=580793&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c (original)
+++ tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c Sun Sep 30 14:30:49 2007
@@ -128,10 +128,8 @@
     jk_logger_t *log;
 
     /*
-     * Worker stuff
+     * Mount stuff
      */
-    jk_map_t *worker_properties;
-    char *worker_file;
     char *mount_file;
     int mount_file_reload;
     jk_map_t *uri_to_context;
@@ -156,7 +154,7 @@
     /*
      * Setting target worker via environment
      */
-   char *worker_indicator;
+    char *worker_indicator;
 
     /*
      * SSL Support
@@ -220,6 +218,11 @@
 static jk_worker_env_t worker_env;
 static char *jk_shm_file = NULL;
 static size_t jk_shm_size = JK_SHM_DEF_SIZE;
+/*
+ * Worker stuff
+*/
+static jk_map_t *jk_worker_properties = NULL;
+static char *jk_worker_file = NULL;
 
 static int JK_METHOD ws_start_response(jk_ws_service_t *s,
                                        int status,
@@ -915,27 +918,25 @@
 static const char *jk_set_worker_file(cmd_parms * cmd,
                                       void *dummy, char *worker_file)
 {
-    server_rec *s = cmd->server;
     struct stat statbuf;
 
-    jk_server_conf_t *conf =
-        (jk_server_conf_t *) ap_get_module_config(s->module_config,
-                                                  &jk_module);
+    if (jk_worker_file != NULL)
+        return "JkWorkersFile only allowed once";
 
     /* we need an absolute path */
-    conf->worker_file = ap_server_root_relative(cmd->pool, worker_file);
+    jk_worker_file = ap_server_root_relative(cmd->pool, worker_file);
 
 #ifdef CHROOTED_APACHE
-    ap_server_strip_chroot(conf->worker_file, 0);
+    ap_server_strip_chroot(jk_worker_file, 0);
 #endif
 
-    if (conf->worker_file == worker_file)
-        conf->worker_file = ap_pstrdup(cmd->pool, worker_file);
+    if (jk_worker_file == worker_file)
+        jk_worker_file = ap_pstrdup(cmd->pool, worker_file);
 
-    if (conf->worker_file == NULL)
+    if (jk_worker_file == NULL)
         return "JkWorkersFile file name invalid";
 
-    if (stat(conf->worker_file, &statbuf) == -1)
+    if (stat(jk_worker_file, &statbuf) == -1)
         return "Can't find the workers file specified";
 
     return NULL;
@@ -1795,7 +1796,7 @@
         (jk_server_conf_t *) ap_get_module_config(s->module_config,
                                                   &jk_module);
 
-    if (jk_map_read_property(conf->worker_properties, line,
+    if (jk_map_read_property(jk_worker_properties, line,
                              JK_MAP_HANDLE_DUPLICATES, conf->log) == JK_FALSE)
         return ap_pstrcat(cmd->temp_pool, "Invalid JkWorkerProperty ", line, NULL);
 
@@ -2176,9 +2177,6 @@
     jk_server_conf_t *c =
         (jk_server_conf_t *) ap_pcalloc(p, sizeof(jk_server_conf_t));
 
-    c->worker_properties = NULL;
-    jk_map_alloc(&c->worker_properties);
-    c->worker_file = NULL;
     c->mount_file = NULL;
     c->log_file = NULL;
     c->log_fd = -1;
@@ -2237,7 +2235,6 @@
     c->envvar_items = ap_make_array(p, 0, sizeof(envvar_item));
 
     c->s = s;
-    jk_map_put(c->worker_properties, "ServerRoot", ap_server_root, NULL);
 
     return c;
 }
@@ -2475,7 +2472,8 @@
     jk_server_conf_t *conf =
         (jk_server_conf_t *) ap_get_module_config(s->module_config,
                                                   &jk_module);
-    jk_map_t *init_map = conf->worker_properties;
+    jk_map_alloc(&jk_worker_properties);
+    jk_map_put(jk_worker_properties, "ServerRoot", ap_server_root, NULL);
 
     jk_log_fds = ap_make_table(p, 0);
 
@@ -2568,15 +2566,16 @@
      * to make sure log file gets closed in the parent process  */
     ap_register_cleanup(p, s, jk_server_cleanup, ap_null_cleanup);
 
-    if ((conf->worker_file != NULL) &&
-        !jk_map_read_properties(init_map, conf->worker_file, NULL,
+    if ((jk_worker_file != NULL) &&
+        !jk_map_read_properties(jk_worker_properties, jk_worker_file, NULL,
                                 JK_MAP_HANDLE_DUPLICATES, conf->log)) {
         jk_error_exit(APLOG_MARK, APLOG_EMERG | APLOG_NOERRNO, s, p,
                       "Error in reading worker properties from '%s'",
-                      conf->worker_file);
+                      jk_worker_file);
     }
 
-    if (jk_map_resolve_references(init_map, "worker.", 1, 1, conf->log) == JK_FALSE) {
+    if (jk_map_resolve_references(jk_worker_properties, "worker.",
+                                  1, 1, conf->log) == JK_FALSE) {
         jk_error_exit(APLOG_MARK, APLOG_EMERG | APLOG_NOERRNO, s, p,
                       "Error in resolving configuration references");
     }
@@ -2586,7 +2585,7 @@
     worker_env.virtual = "*";       /* for now */
     worker_env.server_name = (char *)ap_get_server_version();
 
-    if (wc_open(init_map, &worker_env, conf->log)) {
+    if (wc_open(jk_worker_properties, &worker_env, conf->log)) {
 #if MODULE_MAGIC_NUMBER >= 19980527
         /* Tell apache we're here */
         ap_add_version_component(JK_EXPOSED_VERSION);
@@ -2871,6 +2870,12 @@
 
     server_rec *tmp = s;
 
+    if (jk_worker_properties) {
+        jk_map_free(&jk_worker_properties);
+        jk_worker_properties = NULL;
+        jk_worker_file = NULL;
+    }
+
     /* loop through all available servers to clean up all configuration
      * records we've created
      */
@@ -2883,7 +2888,6 @@
             wc_close(NULL);
             uri_worker_map_free(&(conf->uw_map), NULL);
             jk_map_free(&(conf->uri_to_context));
-            jk_map_free(&(conf->worker_properties));
         }
         tmp = tmp->next;
     }

Modified: tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c?rev=580793&r1=580792&r2=580793&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c (original)
+++ tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c Sun Sep 30 14:30:49 2007
@@ -157,10 +157,8 @@
     apr_file_t *jklogfp;
 
     /*
-     * Worker stuff
+     * Mount stuff
      */
-    jk_map_t *worker_properties;
-    char *worker_file;
     char *mount_file;
     int mount_file_reload;
     jk_map_t *uri_to_context;
@@ -233,6 +231,11 @@
 static apr_global_mutex_t *jk_log_lock = NULL;
 static char *jk_shm_file = NULL;
 static size_t jk_shm_size = JK_SHM_DEF_SIZE;
+/*
+ * Worker stuff
+*/
+static jk_map_t *jk_worker_properties = NULL;
+static char *jk_worker_file = NULL;
 
 static int JK_METHOD ws_start_response(jk_ws_service_t *s,
                                        int status,
@@ -943,24 +946,21 @@
 static const char *jk_set_worker_file(cmd_parms * cmd,
                                       void *dummy, const char *worker_file)
 {
-    server_rec *s = cmd->server;
-
-    jk_server_conf_t *conf =
-        (jk_server_conf_t *) ap_get_module_config(s->module_config,
-                                                  &jk_module);
-
     const char *err_string = ap_check_cmd_context(cmd, GLOBAL_ONLY);
     if (err_string != NULL) {
         return err_string;
     }
 
+    if (jk_worker_file != NULL)
+        return "JkWorkersFile only allowed once";
+
     /* we need an absolute path (ap_server_root_relative does the ap_pstrdup) */
-    conf->worker_file = ap_server_root_relative(cmd->pool, worker_file);
+    jk_worker_file = ap_server_root_relative(cmd->pool, worker_file);
 
-    if (conf->worker_file == NULL)
+    if (jk_worker_file == NULL)
         return "JkWorkersFile file name invalid";
 
-    if (jk_file_exists(conf->worker_file) != JK_TRUE)
+    if (jk_file_exists(jk_worker_file) != JK_TRUE)
         return "Can't find the workers file specified";
 
     return NULL;
@@ -1827,7 +1827,7 @@
         return err_string;
     }
 
-    if (jk_map_read_property(conf->worker_properties, line,
+    if (jk_map_read_property(jk_worker_properties, line,
                              JK_MAP_HANDLE_DUPLICATES, conf->log) == JK_FALSE)
         return apr_pstrcat(cmd->temp_pool, "Invalid JkWorkerProperty ", line, NULL);
 
@@ -2258,26 +2258,29 @@
 {
     server_rec *s = data;
 
+    if (jk_worker_properties) {
+        jk_map_free(&jk_worker_properties);
+        jk_worker_properties = NULL;
+        jk_worker_file = NULL;
+    }
+
     while (NULL != s) {
         jk_server_conf_t *conf =
             (jk_server_conf_t *) ap_get_module_config(s->module_config,
                                                       &jk_module);
 
-        if (conf && conf->worker_properties) {
+        if (conf && conf->uw_map) {
             /* On pool cleanup pass NULL for the jk_logger to
                prevent segmentation faults on Windows because
                we can't guarantee what order pools get cleaned
                up between APR implementations. */
             if (conf->was_initialized)
                 wc_close(NULL);
-            if (conf->worker_properties)
-                jk_map_free(&conf->worker_properties);
             if (conf->uri_to_context)
                 jk_map_free(&conf->uri_to_context);
             if (conf->uw_map)
                 uri_worker_map_free(&conf->uw_map, NULL);
             conf->was_initialized   = JK_FALSE;
-            conf->worker_properties = NULL;
         }
         s = s->next;
     }
@@ -2292,9 +2295,6 @@
     jk_server_conf_t *c =
         (jk_server_conf_t *) apr_pcalloc(p, sizeof(jk_server_conf_t));
 
-    c->worker_properties = NULL;
-    jk_map_alloc(&c->worker_properties);
-    c->worker_file = NULL;
     c->mount_file = NULL;
     c->log_file = NULL;
     c->log = NULL;
@@ -2354,7 +2354,6 @@
     c->envvar_items = apr_array_make(p, 0, sizeof(envvar_item));
 
     c->s = s;
-    jk_map_put(c->worker_properties, "ServerRoot", ap_server_root, NULL);
     apr_pool_cleanup_register(p, s, jk_apr_pool_cleanup, jk_apr_pool_cleanup);
     return c;
 }
@@ -2657,8 +2656,8 @@
     int is_threaded;
     int mpm_threads = 1;
 
-    /*     jk_map_t *init_map = NULL; */
-    jk_map_t *init_map = conf->worker_properties;
+    jk_map_alloc(&jk_worker_properties);
+    jk_map_put(jk_worker_properties, "ServerRoot", ap_server_root, NULL);
 
 #if !defined(WIN32) && !defined(NETWARE)
     if (!jk_shm_file) {
@@ -2693,16 +2692,17 @@
                mpm_threads);
     jk_set_worker_def_cache_size(mpm_threads);
 
-    if ((conf->worker_file != NULL) &&
-        !jk_map_read_properties(init_map, conf->worker_file, NULL,
+    if ((jk_worker_file != NULL) &&
+        !jk_map_read_properties(jk_worker_properties, jk_worker_file, NULL,
                                 JK_MAP_HANDLE_DUPLICATES, conf->log)) {
         ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s,
                      "Error in reading worker properties from '%s'",
-                     conf->worker_file);
+                     jk_worker_file);
         return JK_FALSE;
     }
 
-    if (jk_map_resolve_references(init_map, "worker.", 1, 1, conf->log) == JK_FALSE) {
+    if (jk_map_resolve_references(jk_worker_properties, "worker.",
+                                  1, 1, conf->log) == JK_FALSE) {
         ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s,
                      "Error in resolving configuration references");
         return JK_FALSE;
@@ -2718,7 +2718,7 @@
     worker_env.server_name = (char *)ap_get_server_version();
 #endif
 
-    if (wc_open(init_map, &worker_env, conf->log)) {
+    if (wc_open(jk_worker_properties, &worker_env, conf->log)) {
         ap_add_version_component(pconf, JK_EXPOSED_VERSION);
         jk_log(conf->log, JK_LOG_INFO,
                "%s initialized",



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


Mime
View raw message