diff src/http/ngx_http_write_filter_module.c @ 1197:493a227edfd5

sendfile_max_chunk
author Igor Sysoev <igor@sysoev.ru>
date Mon, 07 May 2007 06:33:39 +0000
parents 8ea6caa62c89
children e67ef50c3176 0bd321c8ce67
line wrap: on
line diff
--- a/src/http/ngx_http_write_filter_module.c
+++ b/src/http/ngx_http_write_filter_module.c
@@ -222,6 +222,9 @@ ngx_http_write_filter(ngx_http_request_t
             return NGX_AGAIN;
         }
 
+    } else if (clcf->sendfile_max_chunk) {
+        limit = clcf->sendfile_max_chunk;
+
     } else {
         limit = 0;
     }
@@ -241,10 +244,14 @@ ngx_http_write_filter(ngx_http_request_t
         return NGX_ERROR;
     }
 
-    if (limit) {
+    if (r->limit_rate) {
         sent = c->sent - sent;
         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) {
+        c->write->delayed = 1;
+        ngx_add_timer(c->write, 1);
     }
 
     for (cl = r->out; cl && cl != chain; /* void */) {