Mercurial > hg > nginx
comparison src/http/ngx_http_file_cache.c @ 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 |
comparison
equal
deleted
inserted
replaced
5878:2c89956b6a76 | 5879:c525c0454aa5 |
---|---|
257 | 257 |
258 if (c->waiting) { | 258 if (c->waiting) { |
259 return NGX_AGAIN; | 259 return NGX_AGAIN; |
260 } | 260 } |
261 | 261 |
262 if (c->buf) { | 262 if (c->reading) { |
263 return ngx_http_file_cache_read(r, c); | 263 return ngx_http_file_cache_read(r, c); |
264 } | 264 } |
265 | 265 |
266 cache = c->file_cache; | 266 cache = c->file_cache; |
267 | 267 |
618 } | 618 } |
619 | 619 |
620 n = ngx_file_aio_read(&c->file, c->buf->pos, c->body_start, 0, r->pool); | 620 n = ngx_file_aio_read(&c->file, c->buf->pos, c->body_start, 0, r->pool); |
621 | 621 |
622 if (n != NGX_AGAIN) { | 622 if (n != NGX_AGAIN) { |
623 c->reading = 0; | |
623 return n; | 624 return n; |
624 } | 625 } |
626 | |
627 c->reading = 1; | |
625 | 628 |
626 c->file.aio->data = r; | 629 c->file.aio->data = r; |
627 c->file.aio->handler = ngx_http_cache_aio_event_handler; | 630 c->file.aio->handler = ngx_http_cache_aio_event_handler; |
628 | 631 |
629 r->main->blocked++; | 632 r->main->blocked++; |