comparison src/core/ngx_output_chain.c @ 334:af451db3fe99

nginx-0.0.3-2004-05-12-09:37:55 import
author Igor Sysoev <igor@sysoev.ru>
date Wed, 12 May 2004 05:37:55 +0000
parents d621239c30f7
children 6bdf858bff8c
comparison
equal deleted inserted replaced
333:be40e9893a19 334:af451db3fe99
79 79
80 if (ctx->free) { 80 if (ctx->free) {
81 ctx->hunk = ctx->free->hunk; 81 ctx->hunk = ctx->free->hunk;
82 ctx->free = ctx->free->next; 82 ctx->free = ctx->free->next;
83 83
84 } else if (ctx->hunks < ctx->bufs.num) { 84 } else if (out || ctx->hunks == ctx->bufs.num) {
85
86 break;
87
88 } else {
85 89
86 size = ctx->bufs.size; 90 size = ctx->bufs.size;
87 91
88 if (ctx->in->hunk->type & NGX_HUNK_LAST) { 92 if (ctx->in->hunk->type & NGX_HUNK_LAST) {
89 93
116 ngx_create_temp_hunk(ctx->pool, size), 120 ngx_create_temp_hunk(ctx->pool, size),
117 NGX_ERROR); 121 NGX_ERROR);
118 ctx->hunk->tag = ctx->tag; 122 ctx->hunk->tag = ctx->tag;
119 ctx->hunk->type |= NGX_HUNK_RECYCLED; 123 ctx->hunk->type |= NGX_HUNK_RECYCLED;
120 ctx->hunks++; 124 ctx->hunks++;
121
122 } else {
123 break;
124 } 125 }
125 } 126 }
126 127
127 rc = ngx_output_chain_copy_hunk(ctx->hunk, ctx->in->hunk, 128 rc = ngx_output_chain_copy_hunk(ctx->hunk, ctx->in->hunk,
128 ctx->sendfile); 129 ctx->sendfile);
146 147
147 ngx_alloc_link_and_set_hunk(cl, ctx->hunk, ctx->pool, NGX_ERROR); 148 ngx_alloc_link_and_set_hunk(cl, ctx->hunk, ctx->pool, NGX_ERROR);
148 *last_out = cl; 149 *last_out = cl;
149 last_out = &cl->next; 150 last_out = &cl->next;
150 ctx->hunk = NULL; 151 ctx->hunk = NULL;
151
152 if (ctx->free == NULL) {
153 break;
154 }
155 } 152 }
156 153
157 if (out == NULL && last != NGX_NONE) { 154 if (out == NULL && last != NGX_NONE) {
158 return last; 155 return last;
159 } 156 }