Welcome! Log In Create A New Profile

Advanced

[nginx] Cache: c->reading flag introduced.

Maxim Dounin
October 27, 2014 02:22PM
details: http://hg.nginx.org/nginx/rev/c525c0454aa5
branches:
changeset: 5879:c525c0454aa5
user: Maxim Dounin <mdounin@mdounin.ru>
date: Mon Oct 27 21:14:07 2014 +0300
description:
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.

diffstat:

src/http/ngx_http_cache.h | 1 +
src/http/ngx_http_file_cache.c | 5 ++++-
2 files changed, 5 insertions(+), 1 deletions(-)

diffs (36 lines):

diff --git a/src/http/ngx_http_cache.h b/src/http/ngx_http_cache.h
--- a/src/http/ngx_http_cache.h
+++ b/src/http/ngx_http_cache.h
@@ -101,6 +101,7 @@ struct ngx_http_cache_s {
unsigned updating:1;
unsigned exists:1;
unsigned temp_file:1;
+ unsigned reading:1;
};


diff --git a/src/http/ngx_http_file_cache.c b/src/http/ngx_http_file_cache.c
--- a/src/http/ngx_http_file_cache.c
+++ b/src/http/ngx_http_file_cache.c
@@ -259,7 +259,7 @@ ngx_http_file_cache_open(ngx_http_reques
return NGX_AGAIN;
}

- if (c->buf) {
+ if (c->reading) {
return ngx_http_file_cache_read(r, c);
}

@@ -620,9 +620,12 @@ ngx_http_file_cache_aio_read(ngx_http_re
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;


_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Cache: c->reading flag introduced.

Maxim Dounin 367 October 27, 2014 02:22PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 160
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready