comparison src/http/ngx_http_write_filter.c @ 4:c5f071d376e5

nginx-0.0.1-2002-08-22-19:24:03 import
author Igor Sysoev <igor@sysoev.ru>
date Thu, 22 Aug 2002 15:24:03 +0000
parents 34a521b1a148
children 708f8bb772ec
comparison
equal deleted inserted replaced
3:34a521b1a148 4:c5f071d376e5
42 /* find size, flush point and last link of saved chain */ 42 /* find size, flush point and last link of saved chain */
43 for (ch = ctx->out; ch; ch = ch->next) { 43 for (ch = ctx->out; ch; ch = ch->next) {
44 prev = &ch->next; 44 prev = &ch->next;
45 size += ch->hunk->last.file - ch->hunk->pos.file; 45 size += ch->hunk->last.file - ch->hunk->pos.file;
46 46
47 ngx_log_debug(r->connection->log, "old chunk: %x %qx %qd" _ 47 ngx_log_debug(r->connection->log, "old chunk: %x " QX_FMT " " QD_FMT _
48 ch->hunk->type _ ch->hunk->pos.file _ 48 ch->hunk->type _ ch->hunk->pos.file _
49 ch->hunk->last.file - ch->hunk->pos.file); 49 ch->hunk->last.file - ch->hunk->pos.file);
50 50
51 if (ch->hunk->type & NGX_HUNK_FLUSH) 51 if (ch->hunk->type & NGX_HUNK_FLUSH)
52 flush = size; 52 flush = size;
55 last = 1; 55 last = 1;
56 } 56 }
57 57
58 /* add new chain to existent one */ 58 /* add new chain to existent one */
59 for (/* void */; in; in = in->next) { 59 for (/* void */; in; in = in->next) {
60 ngx_test_null(ch, ngx_palloc(r->pool, sizeof(ngx_chain_t)), 60 ngx_test_null(ch, ngx_palloc(r->pool, sizeof(ngx_chain_t)), NGX_ERROR);
61 NGX_HTTP_FILTER_ERROR);
62 61
63 ch->hunk = in->hunk; 62 ch->hunk = in->hunk;
64 ch->next = NULL; 63 ch->next = NULL;
65 *prev = ch; 64 *prev = ch;
66 prev = &ch->next; 65 prev = &ch->next;
67 size += ch->hunk->last.file - ch->hunk->pos.file; 66 size += ch->hunk->last.file - ch->hunk->pos.file;
68 67
69 ngx_log_debug(r->connection->log, "new chunk: %x %qx %qd" _ 68 ngx_log_debug(r->connection->log, "new chunk: %x " QX_FMT " " QD_FMT _
70 ch->hunk->type _ ch->hunk->pos.file _ 69 ch->hunk->type _ ch->hunk->pos.file _
71 ch->hunk->last.file - ch->hunk->pos.file); 70 ch->hunk->last.file - ch->hunk->pos.file);
72 71
73 if (ch->hunk->type & NGX_HUNK_FLUSH) 72 if (ch->hunk->type & NGX_HUNK_FLUSH)
74 flush = size; 73 flush = size;
76 if (ch->hunk->type & NGX_HUNK_LAST) 75 if (ch->hunk->type & NGX_HUNK_LAST)
77 last = 1; 76 last = 1;
78 } 77 }
79 78
80 if (!last && flush == 0 && size < ctx->buffer_output) 79 if (!last && flush == 0 && size < ctx->buffer_output)
81 return NGX_HTTP_FILTER_DONE; 80 return NGX_OK;
82 81
83 chain = ngx_event_write(r->connection, ctx->out, flush); 82 chain = ngx_event_write(r->connection, ctx->out, flush);
84 if (chain == (ngx_chain_t *) -1) 83 if (chain == (ngx_chain_t *) -1)
85 return NGX_HTTP_FILTER_ERROR; 84 return NGX_ERROR;
86 85
87 ctx->out = chain; 86 ctx->out = chain;
88 87
89 return (chain ? NGX_HTTP_FILTER_AGAIN : NGX_HTTP_FILTER_DONE); 88 return (chain ? NGX_AGAIN : NGX_OK);
90 } 89 }