r1409, r1413 merge:

set delay only when almost whole sendfile_max_chunk was transferred
This commit is contained in:
Igor Sysoev 2007-09-22 19:23:34 +00:00
parent d0505ea2bb
commit fee8fa15f5
1 changed files with 5 additions and 1 deletions

View File

@ -249,7 +249,11 @@ ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in)
c->write->delayed = 1;
ngx_add_timer(c->write, (ngx_msec_t) (sent * 1000 / r->limit_rate + 1));
} else if (c->write->ready && clcf->sendfile_max_chunk) {
} else if (c->write->ready
&& clcf->sendfile_max_chunk
&& (size_t) (c->sent - sent)
>= clcf->sendfile_max_chunk - 2 * ngx_pagesize)
{
c->write->delayed = 1;
ngx_add_timer(c->write, 1);
}