Mercurial > hg > nginx
changeset 5879:c525c0454aa5
Cache: c->reading flag introduced.
It replaces c->buf in checks in ngx_http_file_cache_open(), making it possible
to reopen the file without clearing c->buf. No functional changes.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 27 Oct 2014 21:14:07 +0300 |
parents | 2c89956b6a76 |
children | 78c49e243848 |
files | src/http/ngx_http_cache.h src/http/ngx_http_file_cache.c |
diffstat | 2 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/http/ngx_http_cache.h Mon Oct 27 21:13:58 2014 +0300 +++ b/src/http/ngx_http_cache.h Mon Oct 27 21:14:07 2014 +0300 @@ -101,6 +101,7 @@ unsigned updating:1; unsigned exists:1; unsigned temp_file:1; + unsigned reading:1; };
--- a/src/http/ngx_http_file_cache.c Mon Oct 27 21:13:58 2014 +0300 +++ b/src/http/ngx_http_file_cache.c Mon Oct 27 21:14:07 2014 +0300 @@ -259,7 +259,7 @@ return NGX_AGAIN; } - if (c->buf) { + if (c->reading) { return ngx_http_file_cache_read(r, c); } @@ -620,9 +620,12 @@ n = ngx_file_aio_read(&c->file, c->buf->pos, c->body_start, 0, r->pool); if (n != NGX_AGAIN) { + c->reading = 0; return n; } + c->reading = 1; + c->file.aio->data = r; c->file.aio->handler = ngx_http_cache_aio_event_handler;