]> git.kaiwu.me - nginx.git/commitdiff
set delay only when almost whole sendfile_max_chunk was transferred
authorIgor Sysoev <igor@sysoev.ru>
Mon, 20 Aug 2007 10:35:41 +0000 (10:35 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Mon, 20 Aug 2007 10:35:41 +0000 (10:35 +0000)
src/http/ngx_http_write_filter_module.c

index 944593ae4953e982706570ac3432796b0b73f494..b1796645e1019de427af5817d049378724e8a1ad 100644 (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);
     }