summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGraham Leggett <minfrin@apache.org>2009-08-27 01:22:18 +0200
committerGraham Leggett <minfrin@apache.org>2009-08-27 01:22:18 +0200
commit9bf71872c9fe971de9c41b1cb46f98b8c8fa8434 (patch)
tree092a55b115adb156860498d61543919755f36d3e
parentUpdate transformations. (diff)
downloadapache2-9bf71872c9fe971de9c41b1cb46f98b8c8fa8434.tar.xz
apache2-9bf71872c9fe971de9c41b1cb46f98b8c8fa8434.zip
Reintroduce an optimisation lost in some cut and paste. The cache lock
is removed as soon as we see an EOS, or is removed immediately if a failure has occurred. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@808220 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--modules/cache/cache_util.c4
-rw-r--r--modules/cache/mod_cache.c39
2 files changed, 15 insertions, 28 deletions
diff --git a/modules/cache/cache_util.c b/modules/cache/cache_util.c
index 3b70af29ae..e287553ccd 100644
--- a/modules/cache/cache_util.c
+++ b/modules/cache/cache_util.c
@@ -168,7 +168,7 @@ CACHE_DECLARE(apr_int64_t) ap_cache_current_age(cache_info *info,
* Try obtain a cache wide lock on the given cache key.
*
* If we return APR_SUCCESS, we obtained the lock, and we are clear to
- * proceed to the backend. If we return APR_EEXISTS, the the lock is
+ * proceed to the backend. If we return APR_EEXISTS, then the lock is
* already locked, someone else has gone to refresh the backend data
* already, so we must return stale data with a warning in the mean
* time. If we return anything else, then something has gone pear
@@ -177,7 +177,7 @@ CACHE_DECLARE(apr_int64_t) ap_cache_current_age(cache_info *info,
* This lock is created from the request pool, meaning that should
* something go wrong and the lock isn't deleted on return of the
* request headers from the backend for whatever reason, at worst the
- * lock will be cleaned up when the request is dies or finishes.
+ * lock will be cleaned up when the request dies or finishes.
*
* If something goes truly bananas and the lock isn't deleted when the
* request dies, the lock will be trashed when its max-age is reached,
diff --git a/modules/cache/mod_cache.c b/modules/cache/mod_cache.c
index e0d6f5547f..b5e616b69c 100644
--- a/modules/cache/mod_cache.c
+++ b/modules/cache/mod_cache.c
@@ -393,19 +393,14 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
/* give someone else the chance to cache the file */
ap_cache_remove_lock(conf, r, cache->handle ?
- (char *)cache->handle->cache_obj->key : NULL, in);
+ (char *)cache->handle->cache_obj->key : NULL, NULL);
}
+ else {
+
+ /* proactively remove the lock as soon as we see the eos bucket */
+ ap_cache_remove_lock(conf, r, cache->handle ?
+ (char *)cache->handle->cache_obj->key : NULL, in);
- /* proactively remove the lock as soon as we see the eos bucket */
- for (e = APR_BRIGADE_FIRST(in);
- e != APR_BRIGADE_SENTINEL(in);
- e = APR_BUCKET_NEXT(e))
- {
- if (APR_BUCKET_IS_EOS(e)) {
- ap_cache_remove_lock(conf, r, cache->handle ?
- (char *)cache->handle->cache_obj->key : NULL, in);
- break;
- }
}
return ap_pass_brigade(f->next, in);
@@ -595,7 +590,7 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
/* remove the lock file unconditionally */
ap_cache_remove_lock(conf, r, cache->handle ?
- (char *)cache->handle->cache_obj->key : NULL, in);
+ (char *)cache->handle->cache_obj->key : NULL, NULL);
/* ship the data up the stack */
return ap_pass_brigade(f->next, in);
@@ -698,7 +693,7 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
/* Caching layer declined the opportunity to cache the response */
ap_remove_output_filter(f);
ap_cache_remove_lock(conf, r, cache->handle ?
- (char *)cache->handle->cache_obj->key : NULL, in);
+ (char *)cache->handle->cache_obj->key : NULL, NULL);
return ap_pass_brigade(f->next, in);
}
@@ -894,7 +889,7 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
/* let someone else attempt to cache */
ap_cache_remove_lock(conf, r, cache->handle ?
- (char *)cache->handle->cache_obj->key : NULL, in);
+ (char *)cache->handle->cache_obj->key : NULL, NULL);
return ap_pass_brigade(f->next, bb);
}
@@ -905,7 +900,7 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
ap_remove_output_filter(f);
ap_cache_remove_lock(conf, r, cache->handle ?
- (char *)cache->handle->cache_obj->key : NULL, in);
+ (char *)cache->handle->cache_obj->key : NULL, NULL);
return ap_pass_brigade(f->next, in);
}
@@ -915,21 +910,13 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
"cache: store_body failed");
ap_remove_output_filter(f);
ap_cache_remove_lock(conf, r, cache->handle ?
- (char *)cache->handle->cache_obj->key : NULL, in);
+ (char *)cache->handle->cache_obj->key : NULL, NULL);
return ap_pass_brigade(f->next, in);
}
/* proactively remove the lock as soon as we see the eos bucket */
- for (e = APR_BRIGADE_FIRST(in);
- e != APR_BRIGADE_SENTINEL(in);
- e = APR_BUCKET_NEXT(e))
- {
- if (APR_BUCKET_IS_EOS(e)) {
- ap_cache_remove_lock(conf, r, cache->handle ?
- (char *)cache->handle->cache_obj->key : NULL, in);
- break;
- }
- }
+ ap_cache_remove_lock(conf, r, cache->handle ?
+ (char *)cache->handle->cache_obj->key : NULL, in);
return ap_pass_brigade(f->next, in);
}