comparison src/event/ngx_event_pipe.c @ 50:72eb30262aac NGINX_0_1_25

nginx 0.1.25 *) Bugfix: nginx did run on Linux parisc. *) Feature: nginx now does not start under FreeBSD if the sysctl kern.ipc.somaxconn value is too big. *) Bugfix: if a request was internally redirected by the ngx_http_index_module module to the ngx_http_proxy_module or ngx_http_fastcgi_module modules, then the index file was not closed after request completion. *) Feature: the "proxy_pass" can be used in location with regular expression. *) Feature: the ngx_http_rewrite_filter_module module supports the condition like "if ($HTTP_USER_AGENT ~ MSIE)". *) Bugfix: nginx started too slow if the large number of addresses and text values were used in the "geo" directive. *) Change: a variable name must be declared as "$name" in the "geo" directive. The previous variant without "$" is still supported, but will be removed soon. *) Feature: the "%{VARIABLE}v" logging parameter. *) Feature: the "set $name value" directive. *) Bugfix: gcc 4.0 compatibility. *) Feature: the --with-openssl-opt=OPTIONS autoconfiguration directive.
author Igor Sysoev <http://sysoev.ru>
date Sat, 19 Mar 2005 00:00:00 +0300
parents da8c190bdaba
children 3050baa54a26
comparison
equal deleted inserted replaced
49:93dabbc9efb9 50:72eb30262aac
163 163
164 } else if (p->allocated < p->bufs.num) { 164 } else if (p->allocated < p->bufs.num) {
165 165
166 /* allocate a new buf if it's still allowed */ 166 /* allocate a new buf if it's still allowed */
167 167
168 if (!(b = ngx_create_temp_buf(p->pool, p->bufs.size))) { 168 b = ngx_create_temp_buf(p->pool, p->bufs.size);
169 if (b == NULL) {
169 return NGX_ABORT; 170 return NGX_ABORT;
170 } 171 }
171 172
172 p->allocated++; 173 p->allocated++;
173 174
174 if (!(chain = ngx_alloc_chain_link(p->pool))) { 175 chain = ngx_alloc_chain_link(p->pool);
176 if (chain == NULL) {
175 return NGX_ABORT; 177 return NGX_ABORT;
176 } 178 }
177 179
178 chain->buf = b; 180 chain->buf = b;
179 chain->next = NULL; 181 chain->next = NULL;
493 if (cl->buf->recycled) { 495 if (cl->buf->recycled) {
494 bsize += cl->buf->last - cl->buf->pos; 496 bsize += cl->buf->last - cl->buf->pos;
495 } 497 }
496 498
497 cl->next = NULL; 499 cl->next = NULL;
498 ngx_chain_add_link(out, ll, cl); 500
501 if (out) {
502 *ll = cl;
503 } else {
504 out = cl;
505 }
506 ll = &cl->next;
499 } 507 }
500 508
501 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, p->log, 0, 509 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, p->log, 0,
502 "pipe write: out:%p, f:%d", out, flush); 510 "pipe write: out:%p, f:%d", out, flush);
503 511
633 b->file_last = p->temp_file->offset; 641 b->file_last = p->temp_file->offset;
634 642
635 b->in_file = 1; 643 b->in_file = 1;
636 b->temp_file = 1; 644 b->temp_file = 1;
637 645
638 ngx_chain_add_link(p->out, p->last_out, cl); 646 if (p->out) {
647 *p->last_out = cl;
648 } else {
649 p->out = cl;
650 }
651 p->last_out = &cl->next;
639 652
640 if (b->last_shadow) { 653 if (b->last_shadow) {
641 654
642 if (!(tl = ngx_alloc_chain_link(p->pool))) { 655 tl = ngx_alloc_chain_link(p->pool);
656 if (tl == NULL) {
643 return NGX_ABORT; 657 return NGX_ABORT;
644 } 658 }
645 659
646 tl->buf = b->shadow; 660 tl->buf = b->shadow;
647 tl->next = NULL; 661 tl->next = NULL;
674 if (p->free) { 688 if (p->free) {
675 b = p->free->buf; 689 b = p->free->buf;
676 p->free = p->free->next; 690 p->free = p->free->next;
677 691
678 } else { 692 } else {
679 if (!(b = ngx_alloc_buf(p->pool))) { 693 b = ngx_alloc_buf(p->pool);
694 if (b == NULL) {
680 return NGX_ERROR; 695 return NGX_ERROR;
681 } 696 }
682 } 697 }
683 698
684 ngx_memcpy(b, buf, sizeof(ngx_buf_t)); 699 ngx_memcpy(b, buf, sizeof(ngx_buf_t));
686 b->tag = p->tag; 701 b->tag = p->tag;
687 b->last_shadow = 1; 702 b->last_shadow = 1;
688 b->recycled = 1; 703 b->recycled = 1;
689 buf->shadow = b; 704 buf->shadow = b;
690 705
691 if (!(cl = ngx_alloc_chain_link(p->pool))) { 706 cl = ngx_alloc_chain_link(p->pool);
707 if (cl == NULL) {
692 return NGX_ERROR; 708 return NGX_ERROR;
693 } 709 }
694 710
695 cl->buf = b; 711 cl->buf = b;
696 cl->next = NULL; 712 cl->next = NULL;
697 713
698 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, "input buf #%d", b->num); 714 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, "input buf #%d", b->num);
699 715
700 ngx_chain_add_link(p->in, p->last_in, cl); 716 if (p->in) {
717 *p->last_in = cl;
718 } else {
719 p->in = cl;
720 }
721 p->last_in = &cl->next;
701 722
702 return NGX_OK; 723 return NGX_OK;
703 } 724 }
704 725
705 726
764 785
765 ngx_int_t ngx_event_pipe_add_free_buf(ngx_event_pipe_t *p, ngx_buf_t *b) 786 ngx_int_t ngx_event_pipe_add_free_buf(ngx_event_pipe_t *p, ngx_buf_t *b)
766 { 787 {
767 ngx_chain_t *cl; 788 ngx_chain_t *cl;
768 789
769 if (!(cl = ngx_alloc_chain_link(p->pool))) { 790 cl = ngx_alloc_chain_link(p->pool);
791 if (cl == NULL) {
770 return NGX_ERROR; 792 return NGX_ERROR;
771 } 793 }
772 794
773 b->pos = b->start; 795 b->pos = b->start;
774 b->last = b->start; 796 b->last = b->start;