comparison src/core/ngx_output_chain.c @ 6046:66176dfea01e

Output chain: free chain links in ngx_chain_writer().
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 23 Mar 2015 21:09:05 +0300
parents 6ab301ddf469
children c5f81dcf97a7
comparison
equal deleted inserted replaced
6045:6ab301ddf469 6046:66176dfea01e
652 ngx_chain_writer(void *data, ngx_chain_t *in) 652 ngx_chain_writer(void *data, ngx_chain_t *in)
653 { 653 {
654 ngx_chain_writer_ctx_t *ctx = data; 654 ngx_chain_writer_ctx_t *ctx = data;
655 655
656 off_t size; 656 off_t size;
657 ngx_chain_t *cl; 657 ngx_chain_t *cl, *ln, *chain;
658 ngx_connection_t *c; 658 ngx_connection_t *c;
659 659
660 c = ctx->connection; 660 c = ctx->connection;
661 661
662 for (size = 0; in; in = in->next) { 662 for (size = 0; in; in = in->next) {
732 732
733 if (size == 0 && !c->buffered) { 733 if (size == 0 && !c->buffered) {
734 return NGX_OK; 734 return NGX_OK;
735 } 735 }
736 736
737 ctx->out = c->send_chain(c, ctx->out, ctx->limit); 737 chain = c->send_chain(c, ctx->out, ctx->limit);
738 738
739 ngx_log_debug1(NGX_LOG_DEBUG_CORE, c->log, 0, 739 ngx_log_debug1(NGX_LOG_DEBUG_CORE, c->log, 0,
740 "chain writer out: %p", ctx->out); 740 "chain writer out: %p", chain);
741 741
742 if (ctx->out == NGX_CHAIN_ERROR) { 742 if (chain == NGX_CHAIN_ERROR) {
743 return NGX_ERROR; 743 return NGX_ERROR;
744 } 744 }
745
746 for (cl = ctx->out; cl && cl != chain; /* void */) {
747 ln = cl;
748 cl = cl->next;
749 ngx_free_chain(ctx->pool, ln);
750 }
751
752 ctx->out = chain;
745 753
746 if (ctx->out == NULL) { 754 if (ctx->out == NULL) {
747 ctx->last = &ctx->out; 755 ctx->last = &ctx->out;
748 756
749 if (!c->buffered) { 757 if (!c->buffered) {