Mercurial > hg > nginx
comparison src/core/ngx_output_chain.c @ 320:d621239c30f7
nginx-0.0.3-2004-04-18-23:06:02 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 18 Apr 2004 19:06:02 +0000 |
parents | 5cfd65b8b0a7 |
children | af451db3fe99 |
comparison
equal
deleted
inserted
replaced
319:7a8ebba985a9 | 320:d621239c30f7 |
---|---|
18 int rc, last; | 18 int rc, last; |
19 size_t size, hsize; | 19 size_t size, hsize; |
20 ngx_chain_t *cl, *out, **last_out; | 20 ngx_chain_t *cl, *out, **last_out; |
21 | 21 |
22 /* | 22 /* |
23 * the short path for the case when the chain ctx->in is empty | 23 * the short path for the case when the ctx->in chain is empty |
24 * and the incoming chain is empty too or it has the single hunk | 24 * and the incoming chain is empty too or it has the single hunk |
25 * that does not require the copy | 25 * that does not require the copy |
26 */ | 26 */ |
27 | 27 |
28 if (ctx->in == NULL) { | 28 if (ctx->in == NULL) { |
52 | 52 |
53 for ( ;; ) { | 53 for ( ;; ) { |
54 | 54 |
55 while (ctx->in) { | 55 while (ctx->in) { |
56 | 56 |
57 /* | |
58 * cycle while there are the ctx->in hunks | |
59 * or there are the free output hunks to copy in | |
60 */ | |
61 | |
57 if (!ngx_output_chain_need_to_copy(ctx, ctx->in->hunk)) { | 62 if (!ngx_output_chain_need_to_copy(ctx, ctx->in->hunk)) { |
58 | 63 |
59 /* move the chain link to the chain out */ | 64 /* move the chain link to the output chain */ |
60 | 65 |
61 cl = ctx->in; | 66 cl = ctx->in; |
62 ctx->in = cl->next; | 67 ctx->in = cl->next; |
63 | 68 |
64 *last_out = cl; | 69 *last_out = cl; |
131 break; | 136 break; |
132 } | 137 } |
133 return rc; | 138 return rc; |
134 } | 139 } |
135 | 140 |
136 /* delete the completed hunk from the chain ctx->in */ | 141 /* delete the completed hunk from the ctx->in chain */ |
137 | 142 |
138 if (ngx_hunk_size(ctx->in->hunk) == 0) { | 143 if (ngx_hunk_size(ctx->in->hunk) == 0) { |
139 ctx->in = ctx->in->next; | 144 ctx->in = ctx->in->next; |
140 } | 145 } |
141 | 146 |
155 | 160 |
156 last = ctx->output_filter(ctx->filter_ctx, out); | 161 last = ctx->output_filter(ctx->filter_ctx, out); |
157 | 162 |
158 ngx_chain_update_chains(&ctx->free, &ctx->busy, &out, ctx->tag); | 163 ngx_chain_update_chains(&ctx->free, &ctx->busy, &out, ctx->tag); |
159 last_out = &out; | 164 last_out = &out; |
165 | |
166 if (last == NGX_ERROR) { | |
167 return last; | |
168 } | |
160 } | 169 } |
161 } | 170 } |
162 | 171 |
163 | 172 |
164 ngx_inline static int ngx_output_chain_need_to_copy(ngx_output_chain_ctx_t *ctx, | 173 ngx_inline static int ngx_output_chain_need_to_copy(ngx_output_chain_ctx_t *ctx, |