Mercurial > hg > nginx-quic
comparison src/event/ngx_event_openssl.c @ 399:4e21d1291a14
nginx-0.0.7-2004-07-25-22:34:14 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 25 Jul 2004 18:34:14 +0000 |
parents | 201b5f68b59f |
children | da8c5707af39 |
comparison
equal
deleted
inserted
replaced
398:201b5f68b59f | 399:4e21d1291a14 |
---|---|
116 | 116 |
117 ngx_chain_t *ngx_ssl_send_chain(ngx_connection_t *c, ngx_chain_t *in, | 117 ngx_chain_t *ngx_ssl_send_chain(ngx_connection_t *c, ngx_chain_t *in, |
118 off_t limit) | 118 off_t limit) |
119 { | 119 { |
120 int n; | 120 int n; |
121 ngx_uint_t flush, last; | 121 ngx_uint_t flush; |
122 ssize_t send, size; | 122 ssize_t send, size; |
123 ngx_buf_t *buf; | 123 ngx_buf_t *buf; |
124 | 124 |
125 buf = c->ssl->buf; | 125 buf = c->ssl->buf; |
126 | 126 |
127 if (in && in->next == NULL && buf->pos == buf->last && !c->ssl->buffer) { | 127 if (in && in->next == NULL && !c->buffered && !c->ssl->buffer) { |
128 | 128 |
129 /* | 129 /* |
130 * we avoid a buffer copy if the incoming buf is a single, | 130 * we avoid a buffer copy if the incoming buf is a single, |
131 * our buffer is empty, and we do not need to buffer the output | 131 * our buffer is empty, and we do not need to buffer the output |
132 */ | 132 */ |
146 return in; | 146 return in; |
147 } | 147 } |
148 | 148 |
149 send = 0; | 149 send = 0; |
150 flush = (in == NULL) ? 1 : 0; | 150 flush = (in == NULL) ? 1 : 0; |
151 last = (in == NULL) ? 1 : 0; | |
152 | 151 |
153 for ( ;; ) { | 152 for ( ;; ) { |
154 | 153 |
155 while (in && buf->last < buf->end) { | 154 while (in && buf->last < buf->end) { |
156 if (in->buf->last_buf) { | 155 if (in->buf->last_buf) { |
157 flush = 1; | 156 flush = 1; |
158 last = 1; | |
159 } | 157 } |
160 | 158 |
161 if (ngx_buf_special(in->buf)) { | 159 if (ngx_buf_special(in->buf)) { |
162 in = in->next; | 160 in = in->next; |
163 continue; | 161 continue; |
224 if (in == NULL || send == limit) { | 222 if (in == NULL || send == limit) { |
225 break; | 223 break; |
226 } | 224 } |
227 } | 225 } |
228 | 226 |
229 if (in) { | 227 c->buffered = (buf->pos < buf->last) ? 1 : 0; |
230 return in; | 228 |
231 } | 229 return in; |
232 | |
233 if (buf->pos == buf->last || !last) { | |
234 return NULL; | |
235 } | |
236 | |
237 return NGX_CHAIN_AGAIN; | |
238 } | 230 } |
239 | 231 |
240 | 232 |
241 static ngx_int_t ngx_ssl_write(ngx_connection_t *c, u_char *data, size_t size) | 233 static ngx_int_t ngx_ssl_write(ngx_connection_t *c, u_char *data, size_t size) |
242 { | 234 { |