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.
This commit is contained in:
parent
9e21d76c07
commit
8814be7b19
2 changed files with 5 additions and 1 deletions
|
@ -101,6 +101,7 @@ struct ngx_http_cache_s {
|
||||||
unsigned updating:1;
|
unsigned updating:1;
|
||||||
unsigned exists:1;
|
unsigned exists:1;
|
||||||
unsigned temp_file:1;
|
unsigned temp_file:1;
|
||||||
|
unsigned reading:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -259,7 +259,7 @@ ngx_http_file_cache_open(ngx_http_request_t *r)
|
||||||
return NGX_AGAIN;
|
return NGX_AGAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->buf) {
|
if (c->reading) {
|
||||||
return ngx_http_file_cache_read(r, c);
|
return ngx_http_file_cache_read(r, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -620,9 +620,12 @@ ngx_http_file_cache_aio_read(ngx_http_request_t *r, ngx_http_cache_t *c)
|
||||||
n = ngx_file_aio_read(&c->file, c->buf->pos, c->body_start, 0, r->pool);
|
n = ngx_file_aio_read(&c->file, c->buf->pos, c->body_start, 0, r->pool);
|
||||||
|
|
||||||
if (n != NGX_AGAIN) {
|
if (n != NGX_AGAIN) {
|
||||||
|
c->reading = 0;
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c->reading = 1;
|
||||||
|
|
||||||
c->file.aio->data = r;
|
c->file.aio->data = r;
|
||||||
c->file.aio->handler = ngx_http_cache_aio_event_handler;
|
c->file.aio->handler = ngx_http_cache_aio_event_handler;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue