Mercurial > hg > ngx_http_delay_module
changeset 2:aee676aa6c1f default tip
Fixed delaying subrequests.
Similar to 7fcf209d40c8 in the limit_req module, we now set wev->delayed
to avoid interference with other subrequests.
With 903fb1ddc07f in nginx (wev->delayed handling moved to the connection
event handler, nginx 1.11.13), it will be also possible to remove
wev->timedout tests and wev->timedout / wev->delayed reset after the timer
expiration. These are preserved for now to make the code compatible with
older nginx versions.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 29 May 2017 18:28:58 +0300 |
parents | 3cdd7ed86819 |
children | |
files | ngx_http_delay_module.c |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ngx_http_delay_module.c +++ b/ngx_http_delay_module.c @@ -92,6 +92,7 @@ ngx_http_delay_handler(ngx_http_request_ r->read_event_handler = ngx_http_test_reading; r->write_event_handler = ngx_http_delay_event_handler; + r->connection->write->delayed = 1; ngx_add_timer(r->connection->write, dcf->delay); ngx_http_set_ctx(r, (void *) 1, ngx_http_delay_module); @@ -110,7 +111,7 @@ ngx_http_delay_event_handler(ngx_http_re wev = r->connection->write; - if (!wev->timedout) { + if (wev->delayed && !wev->timedout) { if (ngx_handle_write_event(wev, 0) != NGX_OK) { ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); @@ -119,6 +120,7 @@ ngx_http_delay_event_handler(ngx_http_re return; } + wev->delayed = 0; wev->timedout = 0; if (ngx_handle_read_event(r->connection->read, 0) != NGX_OK) {