httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkal...@apache.org
Subject svn commit: r1597533 - /httpd/httpd/trunk/modules/cache/cache_util.c
Date Mon, 26 May 2014 09:15:45 GMT
Author: jkaluza
Date: Mon May 26 09:15:44 2014
New Revision: 1597533

URL: http://svn.apache.org/r1597533
Log:
mod_cache: try to use the key of a possible open but stale cache entry
if we have one in cache_try_lock(). PR 50317

Submitted by: Ruediger Pluem

Modified:
    httpd/httpd/trunk/modules/cache/cache_util.c

Modified: httpd/httpd/trunk/modules/cache/cache_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/cache_util.c?rev=1597533&r1=1597532&r2=1597533&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/cache_util.c (original)
+++ httpd/httpd/trunk/modules/cache/cache_util.c Mon May 26 09:15:44 2014
@@ -284,7 +284,25 @@ apr_status_t cache_try_lock(cache_server
 
     /* create the key if it doesn't exist */
     if (!cache->key) {
-        cache_generate_key(r, r->pool, &cache->key);
+        cache_handle_t *h;
+        /*
+         * Try to use the key of a possible open but stale cache
+         * entry if we have one.
+         */
+        if (cache->handle != NULL) {
+            h = cache->handle;
+        }
+        else {
+            h = cache->stale_handle;
+        }
+        if ((h != NULL) &&
+            (h->cache_obj != NULL) &&
+            (h->cache_obj->key != NULL)) {
+            cache->key = apr_pstrdup(r->pool, h->cache_obj->key);
+        }
+        else {
+            cache_generate_key(r, r->pool, &cache->key);
+        }
     }
 
     /* create a hashed filename from the key, and save it for later */



Mime
View raw message