Mercurial > hg > nginx
comparison src/http/ngx_http_file_cache.c @ 3694:dfb17155eca9
delete empty cache zone node if we could not get response to cache
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 15 Jul 2010 13:08:51 +0000 |
parents | 62a4fd1e6e2c |
children | 1c016de812af |
comparison
equal
deleted
inserted
replaced
3693:e3bcc2f4c418 | 3694:dfb17155eca9 |
---|---|
833 | 833 |
834 | 834 |
835 void | 835 void |
836 ngx_http_file_cache_free(ngx_http_request_t *r, ngx_temp_file_t *tf) | 836 ngx_http_file_cache_free(ngx_http_request_t *r, ngx_temp_file_t *tf) |
837 { | 837 { |
838 ngx_http_cache_t *c; | 838 ngx_http_cache_t *c; |
839 ngx_http_file_cache_t *cache; | 839 ngx_http_file_cache_t *cache; |
840 ngx_http_file_cache_node_t *fcn; | |
840 | 841 |
841 c = r->cache; | 842 c = r->cache; |
842 | 843 |
843 if (c->updated) { | 844 if (c->updated) { |
844 return; | 845 return; |
851 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 852 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
852 "http file cache free"); | 853 "http file cache free"); |
853 | 854 |
854 ngx_shmtx_lock(&cache->shpool->mutex); | 855 ngx_shmtx_lock(&cache->shpool->mutex); |
855 | 856 |
856 c->node->count--; | 857 fcn = c->node; |
858 fcn->count--; | |
859 fcn->updating = 0; | |
857 | 860 |
858 if (c->error) { | 861 if (c->error) { |
859 c->node->valid_sec = c->valid_sec; | 862 fcn->valid_sec = c->valid_sec; |
860 c->node->valid_msec = c->valid_msec; | 863 fcn->valid_msec = c->valid_msec; |
861 c->node->error = c->error; | 864 fcn->error = c->error; |
862 } | 865 |
863 | 866 } else if (fcn->valid_msec == 0 && fcn->count == 0) { |
864 c->node->updating = 0; | 867 ngx_queue_remove(&fcn->queue); |
868 ngx_rbtree_delete(&cache->sh->rbtree, &fcn->node); | |
869 ngx_slab_free_locked(cache->shpool, fcn); | |
870 c->node = NULL; | |
871 } | |
865 | 872 |
866 ngx_shmtx_unlock(&cache->shpool->mutex); | 873 ngx_shmtx_unlock(&cache->shpool->mutex); |
867 | 874 |
868 if (c->temp_file) { | 875 if (c->temp_file) { |
869 if (tf && tf->file.fd != NGX_INVALID_FILE) { | 876 if (tf && tf->file.fd != NGX_INVALID_FILE) { |