comparison src/http/ngx_http_write_filter.c @ 63:36d2c25cc9bb

nginx-0.0.1-2003-02-26-23:21:43 import
author Igor Sysoev <igor@sysoev.ru>
date Wed, 26 Feb 2003 20:21:43 +0000
parents 4f3e2abcc2c4
children 5a7d1aaa1618
comparison
equal deleted inserted replaced
62:8ccba41a678e 63:36d2c25cc9bb
2 #include <ngx_config.h> 2 #include <ngx_config.h>
3 3
4 #include <ngx_core.h> 4 #include <ngx_core.h>
5 #include <ngx_hunk.h> 5 #include <ngx_hunk.h>
6 #include <ngx_conf_file.h> 6 #include <ngx_conf_file.h>
7 #include <ngx_connection.h>
7 8
8 #include <ngx_event_write.h> 9 #include <ngx_event_write.h>
9 10
10 #include <ngx_http.h> 11 #include <ngx_http.h>
11 #include <ngx_http_config.h> 12 #include <ngx_http_config.h>
79 /* find the size, the flush point and the last entry of saved chain */ 80 /* find the size, the flush point and the last entry of saved chain */
80 for (ce = ctx->out; ce; ce = ce->next) { 81 for (ce = ctx->out; ce; ce = ce->next) {
81 le = &ce->next; 82 le = &ce->next;
82 size += ce->hunk->last.file - ce->hunk->pos.file; 83 size += ce->hunk->last.file - ce->hunk->pos.file;
83 84
84 #if (NGX_DEBUG_WRITE_FILTER0) 85 #if (NGX_DEBUG_WRITE_FILTER)
85 ngx_log_debug(r->connection->log, "write filter: old chunk: %x " 86 ngx_log_debug(r->connection->log, "write filter: old chunk: %x "
86 QX_FMT " " QD_FMT _ 87 QX_FMT " " QD_FMT _
87 ce->hunk->type _ ce->hunk->pos.file _ 88 ce->hunk->type _ ce->hunk->pos.file _
88 ce->hunk->last.file - ce->hunk->pos.file); 89 ce->hunk->last.file - ce->hunk->pos.file);
89 #endif 90 #endif
105 ce->next = NULL; 106 ce->next = NULL;
106 *le = ce; 107 *le = ce;
107 le = &ce->next; 108 le = &ce->next;
108 size += ce->hunk->last.file - ce->hunk->pos.file; 109 size += ce->hunk->last.file - ce->hunk->pos.file;
109 110
110 #if (NGX_DEBUG_WRITE_FILTER0) 111 #if (NGX_DEBUG_WRITE_FILTER)
111 ngx_log_debug(r->connection->log, "write filter: new hunk: %x " 112 ngx_log_debug(r->connection->log, "write filter: new hunk: %x "
112 QX_FMT " " QD_FMT _ 113 QX_FMT " " QD_FMT _
113 ce->hunk->type _ ce->hunk->pos.file _ 114 ce->hunk->type _ ce->hunk->pos.file _
114 ce->hunk->last.file - ce->hunk->pos.file); 115 ce->hunk->last.file - ce->hunk->pos.file);
115 #endif 116 #endif
125 126
126 conf = (ngx_http_write_filter_conf_t *) 127 conf = (ngx_http_write_filter_conf_t *)
127 ngx_http_get_module_loc_conf(r->main ? r->main : r, 128 ngx_http_get_module_loc_conf(r->main ? r->main : r,
128 ngx_http_write_filter_module); 129 ngx_http_write_filter_module);
129 130
130 #if (NGX_DEBUG_WRITE_FILTER0) 131 #if (NGX_DEBUG_WRITE_FILTER)
131 ngx_log_debug(r->connection->log, "write filter: last:%d flush:%d" _ 132 ngx_log_debug(r->connection->log, "write filter: last:%d flush:%d" _
132 last _ flush); 133 last _ flush);
133 #endif 134 #endif
134 135
135 /* avoid the output if there is no last hunk, no flush point and 136 /* avoid the output if there is no last hunk, no flush point and
136 size of the hunks is smaller then 'write_buffer' */ 137 size of the hunks is smaller then 'write_buffer' */
137 if (!last && flush == 0 && size < conf->buffer_output) { 138 if (!last && flush == 0 && size < conf->buffer_output) {
138 return NGX_OK; 139 return NGX_OK;
139 } 140 }
140 141
141 chain = ngx_event_write(r->connection, ctx->out, flush); 142 chain = ngx_write_chain(r->connection, ctx->out, flush);
142 143
143 #if (NGX_DEBUG_WRITE_FILTER) 144 #if (NGX_DEBUG_WRITE_FILTER)
144 ngx_log_debug(r->connection->log, "write filter %x" _ chain); 145 ngx_log_debug(r->connection->log, "write filter %x" _ chain);
145 #endif 146 #endif
146 147