diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/ngx_file.h | 1 | ||||
| -rw-r--r-- | src/core/ngx_output_chain.c | 11 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/core/ngx_file.h b/src/core/ngx_file.h index 301b1918b..aeb6c0cb2 100644 --- a/src/core/ngx_file.h +++ b/src/core/ngx_file.h @@ -27,6 +27,7 @@ struct ngx_file_s { ngx_int_t (*thread_handler)(ngx_thread_task_t *task, ngx_file_t *file); void *thread_ctx; + ngx_thread_task_t *thread_task; #endif #if (NGX_HAVE_FILE_AIO) diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c index b8361dcd6..f7845787b 100644 --- a/src/core/ngx_output_chain.c +++ b/src/core/ngx_output_chain.c @@ -577,10 +577,15 @@ ngx_output_chain_copy_buf(ngx_output_chain_ctx_t *ctx) } else #endif #if (NGX_THREADS) - if (src->file->thread_handler) { - n = ngx_thread_read(&ctx->thread_task, src->file, dst->pos, - (size_t) size, src->file_pos, ctx->pool); + if (ctx->thread_handler) { + src->file->thread_task = ctx->thread_task; + src->file->thread_handler = ctx->thread_handler; + src->file->thread_ctx = ctx->filter_ctx; + + n = ngx_thread_read(src->file, dst->pos, (size_t) size, + src->file_pos, ctx->pool); if (n == NGX_AGAIN) { + ctx->thread_task = src->file->thread_task; return NGX_AGAIN; } |
