You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by mt...@apache.org on 2005/02/20 19:31:22 UTC

cvs commit: jakarta-tomcat-connectors/jk/native/common jk_shm.c jk_shm.h jk_status.c jk_uri_worker_map.c jk_uri_worker_map.h

mturk       2005/02/20 10:31:22

  Modified:    jk/native/common jk_shm.c jk_shm.h jk_status.c
                        jk_uri_worker_map.c jk_uri_worker_map.h
  Log:
  Remove shared memory uri mappings. Dynamic update will not work
  for multi child servers. Updates will be done rereading uriworkermap
  properties file.
  
  Revision  Changes    Path
  1.16      +1 -17     jakarta-tomcat-connectors/jk/native/common/jk_shm.c
  
  Index: jk_shm.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_shm.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- jk_shm.c	20 Feb 2005 12:21:10 -0000	1.15
  +++ jk_shm.c	20 Feb 2005 18:31:21 -0000	1.16
  @@ -35,7 +35,6 @@
       size_t pos;
       unsigned int childs;
       unsigned int workers;
  -    unsigned int urimaps;
       time_t modified;
       char   buf[1];
   };
  @@ -419,18 +418,3 @@
       }
       return w;
   }
  -
  -jk_shm_urimap_t *jk_shm_alloc_urimap(jk_pool_t *p)
  -{
  -    jk_shm_urimap_t *u = (jk_shm_urimap_t *)jk_shm_alloc(p, sizeof(jk_shm_urimap_t));
  -    if (u) {
  -        memset(u, 0, sizeof(jk_shm_urimap_t));
  -        if (jk_shmem.hdr) {
  -            jk_shmem.hdr->urimaps++;
  -            u->id = jk_shmem.hdr->urimaps;
  -        }
  -        else
  -            u->id = -1;
  -    }
  -    return u;
  -}
  
  
  
  1.15      +1 -15     jakarta-tomcat-connectors/jk/native/common/jk_shm.h
  
  Index: jk_shm.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_shm.h,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- jk_shm.h	20 Feb 2005 12:21:10 -0000	1.14
  +++ jk_shm.h	20 Feb 2005 18:31:21 -0000	1.15
  @@ -88,15 +88,6 @@
   };
   typedef struct jk_shm_worker jk_shm_worker_t;
   
  -/** jk shm uri worker map record structure */
  -struct jk_shm_urimap
  -{
  -    int          id;
  -    int          worker_id;
  -    unsigned int match_type;
  -};
  -typedef struct jk_shm_urimap jk_shm_urimap_t;
  -
   const char *jk_shm_name();
   
   /* Open the shared memory creating file if needed
  @@ -122,11 +113,6 @@
    */
   jk_shm_worker_t *jk_shm_alloc_worker(jk_pool_t *p);
   
  -/* allocate shm uri worker map record
  - * If there is no shm present the pool will be used instead
  - */
  -jk_shm_urimap_t *jk_shm_alloc_urimap(jk_pool_t *p);
  -
   /* Return workers.properties last modified time
    */
   time_t jk_shm_get_workers_time();
  
  
  
  1.21      +4 -19     jakarta-tomcat-connectors/jk/native/common/jk_status.c
  
  Index: jk_status.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_status.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- jk_status.c	20 Feb 2005 13:57:14 -0000	1.20
  +++ jk_status.c	20 Feb 2005 18:31:21 -0000	1.21
  @@ -324,16 +324,13 @@
       unsigned int i;
   
       jk_puts(s, "<br />Uri Mappings:\n");
  -    jk_puts(s, "<table><tr><th>Disabled</th><th>Match Type</th><th>Uri</th></tr>\n");
  +    jk_puts(s, "<table><tr><th>Match Type</th><th>Uri</th></tr>\n");
       for (i = 0; i < uwmap->size; i++) {
           uri_worker_record_t *uwr = uwmap->maps[i];
           if (strcmp(uwr->worker_name, worker))
               continue;
  -        jk_printf(s, "<tr><td><input name=\"mi%d\" type=checkbox", i);
  -        if (uwr->s->match_type & MATCH_TYPE_DISABLED)
  -            jk_puts(s, " checked");
  -        jk_putv(s, "></td><td>",
  -                status_val_match(uwr->s->match_type),
  +        jk_putv(s, "<tr><td>",
  +                status_val_match(uwr->match_type),
                   "</td><td>", NULL);
           jk_puts(s, uwr->uri);
           jk_puts(s, "</td></tr>\n");
  @@ -541,7 +538,6 @@
                             const char *dworker, jk_logger_t *l)
   {
       int i;
  -    unsigned int j;
       char buf[1024];
       const char *b;
       lb_worker_t *lb;
  @@ -557,17 +553,6 @@
               lb->s->recover_wait_time = i;
           lb->s->sticky_session = status_bool("ls", s->query_string);
           lb->s->sticky_session_force = status_bool("lf", s->query_string);
  -        for (j = 0; j < s->uw_map->size; j++) {
  -            uri_worker_record_t *uwr = s->uw_map->maps[j];
  -            if (strcmp(uwr->worker_name, dworker))
  -                continue;
  -            sprintf(buf, "mi%d", j);
  -            if (status_bool(buf, s->query_string))
  -                uwr->s->match_type |= MATCH_TYPE_DISABLED;
  -            else
  -                uwr->s->match_type &= ~MATCH_TYPE_DISABLED;
  -
  -        }
       }
       else  {
           int n = status_int("lb", s->query_string, -1);
  
  
  
  1.48      +18 -26    jakarta-tomcat-connectors/jk/native/common/jk_uri_worker_map.c
  
  Index: jk_uri_worker_map.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_uri_worker_map.c,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- jk_uri_worker_map.c	20 Feb 2005 12:48:51 -0000	1.47
  +++ jk_uri_worker_map.c	20 Feb 2005 18:31:21 -0000	1.48
  @@ -95,7 +95,7 @@
       unsigned i;
   
       for (i = 0; i < uw_map->size; i++) {
  -        if (uw_map->maps[i]->s->match_type == MATCH_TYPE_SUFFIX) {
  +        if (uw_map->maps[i]->match_type == MATCH_TYPE_SUFFIX) {
               char *suffix_start;
               for (suffix_start = strstr(uri, uw_map->maps[i]->suffix);
                    suffix_start;
  @@ -382,7 +382,7 @@
           JK_TRACE_EXIT(l);
           return JK_FALSE;
       }
  -
  +    uwr->match_type = match_type;
       uw_map->maps[uw_map->size] = uwr;
       uw_map->size++;
       if (match_type & MATCH_TYPE_NO_MATCH) {    
  @@ -390,14 +390,6 @@
           uw_map->nosize++;
       }
       worker_qsort(uw_map);
  -    uwr->s = jk_shm_alloc_urimap(&uw_map->p);
  -    if (!uwr->s) {
  -        jk_log(l, JK_LOG_ERROR,
  -               "can't alloc shared memory map entry");
  -        JK_TRACE_EXIT(l);
  -        return JK_FALSE;
  -    }
  -    uwr->s->match_type = match_type;
       JK_TRACE_EXIT(l);
       return JK_TRUE;
   }
  @@ -514,13 +506,13 @@
           uri_worker_record_t *uwr = uw_map->maps[i];
   
           /* Check only nomatch mappings */
  -        if (!(uwr->s->match_type & MATCH_TYPE_NO_MATCH) ||
  -            (uwr->s->match_type & MATCH_TYPE_DISABLED))
  +        if (!(uwr->match_type & MATCH_TYPE_NO_MATCH) ||
  +            (uwr->match_type & MATCH_TYPE_DISABLED))
               continue;        
           /* Check only mathing workers */
           if (strcmp(uwr->worker_name, worker))
               continue;
  -        if (uwr->s->match_type & MATCH_TYPE_WILDCHAR_PATH) {
  +        if (uwr->match_type & MATCH_TYPE_WILDCHAR_PATH) {
               /* Map is already sorted by context_len */
               if (wildchar_match(uri, uwr->context,
   #ifdef WIN32
  @@ -537,7 +529,7 @@
                }
           }
           else if (JK_STRNCMP(uwr->context, uri, uwr->context_len) == 0) {
  -            if (uwr->s->match_type & MATCH_TYPE_EXACT) {
  +            if (uwr->match_type & MATCH_TYPE_EXACT) {
                   if (strlen(uri) == uwr->context_len) {
                       if (JK_IS_DEBUG_LEVEL(l))
                           jk_log(l, JK_LOG_DEBUG,
  @@ -547,7 +539,7 @@
                       return JK_TRUE;
                   }
               }
  -            else if (uwr->s->match_type & MATCH_TYPE_CONTEXT) {
  +            else if (uwr->match_type & MATCH_TYPE_CONTEXT) {
                   if (JK_IS_DEBUG_LEVEL(l))
                       jk_log(l, JK_LOG_DEBUG,
                              "Found a context no match %s -> %s",
  @@ -555,7 +547,7 @@
                   JK_TRACE_EXIT(l);
                   return JK_TRUE;
               }
  -            else if (uwr->s->match_type & MATCH_TYPE_GENERAL_SUFFIX) {
  +            else if (uwr->match_type & MATCH_TYPE_GENERAL_SUFFIX) {
                   int suffix_start = last_index_of(uri, uwr->suffix[0]);
                   if (suffix_start >= 0
                       && 0 == JK_STRCMP(uri + suffix_start, uwr->suffix)) {
  @@ -567,7 +559,7 @@
                           return JK_TRUE;
                   }
               }
  -            else if (uwr->s->match_type & MATCH_TYPE_CONTEXT_PATH) {
  +            else if (uwr->match_type & MATCH_TYPE_CONTEXT_PATH) {
                   char *suffix_path = NULL;
                   if (strlen(uri) > 1
                       && (suffix_path = strchr(uri + 1, '/')) != NULL) {
  @@ -592,7 +584,7 @@
                   if (uri[suffix_start] == '.') {
                       const char *suffix = uri + suffix_start + 1;
                       if (JK_STRCMP(suffix, uwr->suffix) == 0) {
  -                        if (uwr->s->match_type & MATCH_TYPE_NO_MATCH) {
  +                        if (uwr->match_type & MATCH_TYPE_NO_MATCH) {
                               if (JK_IS_DEBUG_LEVEL(l))
                                   jk_log(l, JK_LOG_DEBUG,
                                          "Found a no suffix match for %s -> %s",
  @@ -657,8 +649,8 @@
           uri_worker_record_t *uwr = uw_map->maps[i];
   
           /* Check for match types */
  -        if ((uwr->s->match_type & MATCH_TYPE_DISABLED) ||
  -            (uwr->s->match_type & MATCH_TYPE_NO_MATCH) ||
  +        if ((uwr->match_type & MATCH_TYPE_DISABLED) ||
  +            (uwr->match_type & MATCH_TYPE_NO_MATCH) ||
               (uwr->context_len < longest_match)) {
               /* can not be a best match anyway */
               continue;
  @@ -666,7 +658,7 @@
           if (JK_IS_DEBUG_LEVEL(l))
               jk_log(l, JK_LOG_DEBUG, "Attempting to map context URI '%s'", uwr->uri);
   
  -        if (uwr->s->match_type & MATCH_TYPE_WILDCHAR_PATH) {
  +        if (uwr->match_type & MATCH_TYPE_WILDCHAR_PATH) {
               const char *wname;
               /* Map is already sorted by context_len */
               if (wildchar_match(uri, uwr->context,
  @@ -687,7 +679,7 @@
                }
           }
           else if (JK_STRNCMP(uwr->context, uri, uwr->context_len) == 0) {
  -            if (uwr->s->match_type & MATCH_TYPE_EXACT) {
  +            if (uwr->match_type & MATCH_TYPE_EXACT) {
                   if (strlen(uri) == uwr->context_len) {
                       if (JK_IS_DEBUG_LEVEL(l))
                           jk_log(l, JK_LOG_DEBUG,
  @@ -698,7 +690,7 @@
                       goto cleanup;
                   }
               }
  -            else if (uwr->s->match_type & MATCH_TYPE_CONTEXT) {
  +            else if (uwr->match_type & MATCH_TYPE_CONTEXT) {
                   if (uwr->context_len > longest_match) {
                       if (JK_IS_DEBUG_LEVEL(l))
                           jk_log(l, JK_LOG_DEBUG,
  @@ -708,7 +700,7 @@
                       best_match = i;
                   }
               }
  -            else if (uwr->s->match_type & MATCH_TYPE_GENERAL_SUFFIX) {
  +            else if (uwr->match_type & MATCH_TYPE_GENERAL_SUFFIX) {
                   int suffix_start = last_index_of(uri, uwr->suffix[0]);
                   if (suffix_start >= 0
                       && 0 == strcmp(uri + suffix_start, uwr->suffix)) {
  @@ -722,7 +714,7 @@
                       }
                   }
               }
  -            else if (uwr->s->match_type & MATCH_TYPE_CONTEXT_PATH) {
  +            else if (uwr->match_type & MATCH_TYPE_CONTEXT_PATH) {
                   char *suffix_path = NULL;
                   if (strlen(uri) > 1
                       && (suffix_path = strchr(uri + 1, '/')) != NULL) {
  
  
  
  1.16      +4 -4      jakarta-tomcat-connectors/jk/native/common/jk_uri_worker_map.h
  
  Index: jk_uri_worker_map.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_uri_worker_map.h,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- jk_uri_worker_map.h	20 Feb 2005 12:21:10 -0000	1.15
  +++ jk_uri_worker_map.h	20 Feb 2005 18:31:21 -0000	1.16
  @@ -54,15 +54,15 @@
       /* Name of worker mapped */
       const char *worker_name;
   
  -    /* Shared memory uri->worker mappings */
  -    jk_shm_urimap_t *s;
  -
       /* Suffix of uri */
       const char *suffix;
   
       /* Base context */
       const char *context;
   
  +    /* Match type */
  +    unsigned int match_type;
  +
       /* char length of the context */
       size_t context_len;
   };
  
  
  

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