Mercurial > hg > nginx-quic
comparison src/core/ngx_buf.c @ 5850:f9c83484d9ce
Moved the code for adjusting sent buffers in a separate function.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Wed, 13 Aug 2014 15:11:45 +0400 |
parents | d620f497c50f |
children | de68ed551bfb |
comparison
equal
deleted
inserted
replaced
5849:810e97260edc | 5850:f9c83484d9ce |
---|---|
216 *busy = cl->next; | 216 *busy = cl->next; |
217 cl->next = *free; | 217 cl->next = *free; |
218 *free = cl; | 218 *free = cl; |
219 } | 219 } |
220 } | 220 } |
221 | |
222 | |
223 ngx_chain_t * | |
224 ngx_handle_sent_chain(ngx_chain_t *in, off_t sent) | |
225 { | |
226 off_t size; | |
227 | |
228 for ( /* void */ ; in; in = in->next) { | |
229 | |
230 if (ngx_buf_special(in->buf)) { | |
231 continue; | |
232 } | |
233 | |
234 if (sent == 0) { | |
235 break; | |
236 } | |
237 | |
238 size = ngx_buf_size(in->buf); | |
239 | |
240 if (sent >= size) { | |
241 sent -= size; | |
242 | |
243 if (ngx_buf_in_memory(in->buf)) { | |
244 in->buf->pos = in->buf->last; | |
245 } | |
246 | |
247 if (in->buf->in_file) { | |
248 in->buf->file_pos = in->buf->file_last; | |
249 } | |
250 | |
251 continue; | |
252 } | |
253 | |
254 if (ngx_buf_in_memory(in->buf)) { | |
255 in->buf->pos += (size_t) sent; | |
256 } | |
257 | |
258 if (in->buf->in_file) { | |
259 in->buf->file_pos += sent; | |
260 } | |
261 | |
262 break; | |
263 } | |
264 | |
265 return in; | |
266 } |