Write filter: replaced unneeded loop with one to free chains.

Noted by Gabor Lekeny.
This commit is contained in:
Maxim Dounin 2012-09-05 15:06:47 +00:00
parent 605a0ab2e1
commit 5867c81fe6

View File

@ -185,23 +185,19 @@ ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in)
}
if (size == 0 && !(c->buffered & NGX_LOWLEVEL_BUFFERED)) {
if (last) {
if (last || flush) {
for (cl = r->out; cl; /* void */) {
ln = cl;
cl = cl->next;
ngx_free_chain(r->pool, ln);
}
r->out = NULL;
c->buffered &= ~NGX_HTTP_WRITE_BUFFERED;
return NGX_OK;
}
if (flush) {
do {
r->out = r->out->next;
} while (r->out);
c->buffered &= ~NGX_HTTP_WRITE_BUFFERED;
return NGX_OK;
}
ngx_log_error(NGX_LOG_ALERT, c->log, 0,
"the http output chain is empty");