set delay only when almost whole sendfile_max_chunk was transferred

This commit is contained in:
Igor Sysoev 2007-08-20 10:35:41 +00:00
parent 3854a1e195
commit 7896c39fe8

View File

@ -249,7 +249,10 @@ 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
&& c->sent - sent >= clcf->sendfile_max_chunk - 2 * ngx_pagesize)
{
c->write->delayed = 1;
ngx_add_timer(c->write, 1);
}