comparison src/event/ngx_event_pipe.c @ 56:3050baa54a26 NGINX_0_1_28

nginx 0.1.28 *) Bugfix: nginx hogs CPU while proxying the huge files. *) Bugfix: nginx could not be built by gcc 4.0 on Linux.
author Igor Sysoev <http://sysoev.ru>
date Fri, 08 Apr 2005 00:00:00 +0400
parents 72eb30262aac
children b55cbf18157e
comparison
equal deleted inserted replaced
55:729de7d75018 56:3050baa54a26
82 static ngx_int_t ngx_event_pipe_read_upstream(ngx_event_pipe_t *p) 82 static ngx_int_t ngx_event_pipe_read_upstream(ngx_event_pipe_t *p)
83 { 83 {
84 ssize_t n, size; 84 ssize_t n, size;
85 ngx_int_t rc; 85 ngx_int_t rc;
86 ngx_buf_t *b; 86 ngx_buf_t *b;
87 ngx_chain_t *chain, *cl; 87 ngx_chain_t *chain, *cl, *ln;
88 88
89 if (p->upstream_eof || p->upstream_error || p->upstream_done) { 89 if (p->upstream_eof || p->upstream_error || p->upstream_done) {
90 return NGX_OK; 90 return NGX_OK;
91 } 91 }
92 92
291 if (p->input_filter(p, cl->buf) == NGX_ERROR) { 291 if (p->input_filter(p, cl->buf) == NGX_ERROR) {
292 return NGX_ABORT; 292 return NGX_ABORT;
293 } 293 }
294 294
295 n -= size; 295 n -= size;
296 ln = cl;
296 cl = cl->next; 297 cl = cl->next;
298 ngx_free_chain(p->pool, ln);
297 299
298 } else { 300 } else {
299 cl->buf->last += n; 301 cl->buf->last += n;
300 n = 0; 302 n = 0;
301 } 303 }
684 if (buf->pos == buf->last) { 686 if (buf->pos == buf->last) {
685 return NGX_OK; 687 return NGX_OK;
686 } 688 }
687 689
688 if (p->free) { 690 if (p->free) {
689 b = p->free->buf; 691 cl = p->free;
690 p->free = p->free->next; 692 b = cl->buf;
693 p->free = cl->next;
694 ngx_free_chain(p->pool, cl);
691 695
692 } else { 696 } else {
693 b = ngx_alloc_buf(p->pool); 697 b = ngx_alloc_buf(p->pool);
694 if (b == NULL) { 698 if (b == NULL) {
695 return NGX_ERROR; 699 return NGX_ERROR;