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 Tue, 12 Mar 2002 22:26:07 GMT
stoddard    02/03/12 14:26:07

  Modified:    modules/experimental mod_mem_cache.c
  Log:
  cleanup some code paths
  
  Revision  Changes    Path
  1.34      +13 -16    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.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- mod_mem_cache.c	12 Mar 2002 22:05:21 -0000	1.33
  +++ mod_mem_cache.c	12 Mar 2002 22:26:07 -0000	1.34
  @@ -320,6 +320,8 @@
       /* Reference mem_cache_object_t out of cache_object_t */
       obj->vobj = mobj;
       mobj->m_len = len;
  +    obj->complete = 0;
  +    obj->refcount = 1;
   
       /* Place the cache_object_t into the hash table.
        * Note: Perhaps we should wait to put the object in the
  @@ -343,14 +345,6 @@
           apr_hash_set(sconf->cacheht, obj->key, strlen(obj->key), obj);
           sconf->object_cnt++;
           sconf->cache_size += len;
  -        /* Call a cleanup at the end of the request to garbage collect
  -         * a partially completed (aborted) cache update.
  -         */
  -        obj->complete = 0;
  -        obj->refcount = 1;
  -        obj->cleanup = 1;
  -        apr_pool_cleanup_register(r->pool, obj, decrement_refcount, 
  -                                  apr_pool_cleanup_null);
       }
       if (sconf->lock) {
           apr_thread_mutex_unlock(sconf->lock);
  @@ -365,6 +359,13 @@
           return DECLINED;
       }
   
  +    /* Set the cleanup flag and register the cleanup to cleanup
  +     * the cache_object_t if the cache load is aborted.
  +     */
  +    obj->cleanup = 1;
  +    apr_pool_cleanup_register(r->pool, obj, decrement_refcount, 
  +                              apr_pool_cleanup_null);
  +
       /* Populate the cache handle */
       h->cache_obj = obj;
       h->read_body = &read_body;
  @@ -434,10 +435,8 @@
           apr_hash_set(sconf->cacheht, obj->key, strlen(obj->key), NULL);
           sconf->object_cnt--;
           sconf->cache_size -= mobj->m_len;
  -        if (obj->refcount) {
  -            obj->cleanup = 1;
  -        }
  -        else {
  +        obj->cleanup = 1;
  +        if (!obj->refcount) {
               cleanup_cache_object(obj);
           }
           h->cache_obj = NULL;
  @@ -531,10 +530,8 @@
           apr_hash_set(sconf->cacheht, key, APR_HASH_KEY_STRING, NULL);
           sconf->object_cnt--;
           sconf->cache_size -= mobj->m_len;
  -        if (obj->refcount) {
  -            obj->cleanup = 1;
  -        }
  -        else {
  +        obj->cleanup = 1;
  +        if (!obj->refcount) {
               cleanup_cache_object(obj);
           }
       }
  
  
  

Mime
View raw message