Mercurial > hg > nginx
changeset 3119:4c90c9129a82
fix case when the output filter should add incoming buffers
while waiting on file AIO completion
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 13 Sep 2009 06:28:17 +0000 |
parents | 6f79fac538b9 |
children | 40b8b398dbbc |
files | src/core/ngx_buf.h src/core/ngx_output_chain.c src/http/ngx_http_copy_filter_module.c |
diffstat | 3 files changed, 18 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/core/ngx_buf.h Sun Sep 13 06:25:54 2009 +0000 +++ b/src/core/ngx_buf.h Sun Sep 13 06:28:17 2009 +0000 @@ -89,6 +89,11 @@ #endif unsigned need_in_memory:1; unsigned need_in_temp:1; +#if (NGX_HAVE_FILE_AIO) + unsigned aio:1; + + ngx_output_chain_aio_pt aio_handler; +#endif off_t alignment; @@ -99,10 +104,6 @@ ngx_output_chain_filter_pt output_filter; void *filter_ctx; - -#if (NGX_HAVE_FILE_AIO) - ngx_output_chain_aio_pt aio; -#endif };
--- a/src/core/ngx_output_chain.c Sun Sep 13 06:25:54 2009 +0000 +++ b/src/core/ngx_output_chain.c Sun Sep 13 06:28:17 2009 +0000 @@ -74,6 +74,12 @@ } } +#if (NGX_HAVE_FILE_AIO) + if (ctx->aio) { + return NGX_AGAIN; + } +#endif + out = NULL; last_out = &out; last = NGX_NONE; @@ -519,11 +525,11 @@ #if (NGX_HAVE_FILE_AIO) - if (ctx->aio) { + if (ctx->aio_handler) { n = ngx_file_aio_read(src->file, dst->pos, (size_t) size, src->file_pos, ctx->pool); if (n == NGX_AGAIN) { - ctx->aio(ctx, src->file); + ctx->aio_handler(ctx, src->file); return NGX_AGAIN; }
--- a/src/http/ngx_http_copy_filter_module.c Sun Sep 13 06:25:54 2009 +0000 +++ b/src/http/ngx_http_copy_filter_module.c Sun Sep 13 06:28:17 2009 +0000 @@ -87,10 +87,6 @@ c = r->connection; - if (r->aio) { - return NGX_AGAIN; - } - ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, "http copy filter: \"%V?%V\"", &r->uri, &r->args); @@ -123,7 +119,7 @@ #if (NGX_HAVE_FILE_AIO) if (clcf->aio) { - ctx->aio = ngx_http_copy_aio_handler; + ctx->aio_handler = ngx_http_copy_aio_handler; #if (NGX_HAVE_AIO_SENDFILE) c->aio_sendfile = (clcf->aio == NGX_HTTP_AIO_SENDFILE); #endif @@ -133,6 +129,10 @@ r->request_output = 1; } +#if (NGX_HAVE_FILE_AIO) + ctx->aio = r->aio; +#endif + for ( ;; ) { rc = ngx_output_chain(ctx, in);