httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stodd...@apache.org
Subject cvs commit: httpd-2.0/modules/experimental mod_mem_cache.c
Date Wed, 05 Jun 2002 21:47:58 GMT
stoddard    2002/06/05 14:47:58

  Modified:    modules/experimental mod_mem_cache.c
  Log:
  Fix segfault at startup when the startup fails before running the post config
  hook. We were setting the hash table cleanup in the create_per_server_config
  hook and allocating the hash table in the post config hook. Move the register_cleanup
  to the post_config hook
  
  Revision  Changes    Path
  1.67      +7 -9      httpd-2.0/modules/experimental/mod_mem_cache.c
  
  Index: mod_mem_cache.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_mem_cache.c,v
  retrieving revision 1.66
  retrieving revision 1.67
  diff -u -r1.66 -r1.67
  --- mod_mem_cache.c	5 Jun 2002 18:38:52 -0000	1.66
  +++ mod_mem_cache.c	5 Jun 2002 21:47:58 -0000	1.67
  @@ -288,15 +288,8 @@
    */
   static void *create_cache_config(apr_pool_t *p, server_rec *s)
   {
  -    int threaded_mpm;
  -
       sconf = apr_pcalloc(p, sizeof(mem_cache_conf));
   
  -    ap_mpm_query(AP_MPMQ_IS_THREADED, &threaded_mpm);
  -    if (threaded_mpm) {
  -        apr_thread_mutex_create(&sconf->lock, APR_THREAD_MUTEX_DEFAULT, p);
  -    }
  -
       sconf->min_cache_object_size = DEFAULT_MIN_CACHE_OBJECT_SIZE;
       sconf->max_cache_object_size = DEFAULT_MAX_CACHE_OBJECT_SIZE;
       /* Number of objects in the cache */
  @@ -306,8 +299,6 @@
       sconf->max_cache_size = DEFAULT_MAX_CACHE_SIZE;
       sconf->cache_size = 0;
   
  -    apr_pool_cleanup_register(p, sconf, cleanup_cache_mem, apr_pool_cleanup_null);
  -
       return sconf;
   }
   
  @@ -880,7 +871,14 @@
   static int mem_cache_post_config(apr_pool_t *p, apr_pool_t *plog,
                                    apr_pool_t *ptemp, server_rec *s)
   {
  +    int threaded_mpm;
  +    ap_mpm_query(AP_MPMQ_IS_THREADED, &threaded_mpm);
  +    if (threaded_mpm) {
  +        apr_thread_mutex_create(&sconf->lock, APR_THREAD_MUTEX_DEFAULT, p);
  +    }
       sconf->cacheht = cache_hash_make(sconf->max_object_cnt);
  +    apr_pool_cleanup_register(p, sconf, cleanup_cache_mem, apr_pool_cleanup_null);
  +
       return OK;
   }
   
  
  
  

Mime
View raw message