comparison src/http/ngx_http_copy_filter_module.c @ 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 c09bf4a53b79
children 04cfc09b8b8d
comparison
equal deleted inserted replaced
3118:6f79fac538b9 3119:4c90c9129a82
85 ngx_http_core_loc_conf_t *clcf; 85 ngx_http_core_loc_conf_t *clcf;
86 ngx_http_copy_filter_conf_t *conf; 86 ngx_http_copy_filter_conf_t *conf;
87 87
88 c = r->connection; 88 c = r->connection;
89 89
90 if (r->aio) {
91 return NGX_AGAIN;
92 }
93
94 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, 90 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
95 "http copy filter: \"%V?%V\"", &r->uri, &r->args); 91 "http copy filter: \"%V?%V\"", &r->uri, &r->args);
96 92
97 ctx = ngx_http_get_module_ctx(r, ngx_http_copy_filter_module); 93 ctx = ngx_http_get_module_ctx(r, ngx_http_copy_filter_module);
98 94
121 ctx->output_filter = (ngx_output_chain_filter_pt) ngx_http_next_filter; 117 ctx->output_filter = (ngx_output_chain_filter_pt) ngx_http_next_filter;
122 ctx->filter_ctx = r; 118 ctx->filter_ctx = r;
123 119
124 #if (NGX_HAVE_FILE_AIO) 120 #if (NGX_HAVE_FILE_AIO)
125 if (clcf->aio) { 121 if (clcf->aio) {
126 ctx->aio = ngx_http_copy_aio_handler; 122 ctx->aio_handler = ngx_http_copy_aio_handler;
127 #if (NGX_HAVE_AIO_SENDFILE) 123 #if (NGX_HAVE_AIO_SENDFILE)
128 c->aio_sendfile = (clcf->aio == NGX_HTTP_AIO_SENDFILE); 124 c->aio_sendfile = (clcf->aio == NGX_HTTP_AIO_SENDFILE);
129 #endif 125 #endif
130 } 126 }
131 #endif 127 #endif
132 128
133 r->request_output = 1; 129 r->request_output = 1;
134 } 130 }
131
132 #if (NGX_HAVE_FILE_AIO)
133 ctx->aio = r->aio;
134 #endif
135 135
136 for ( ;; ) { 136 for ( ;; ) {
137 rc = ngx_output_chain(ctx, in); 137 rc = ngx_output_chain(ctx, in);
138 138
139 if (ctx->in == NULL) { 139 if (ctx->in == NULL) {