Mercurial > hg > nginx
comparison src/event/ngx_event_pipe.c @ 175:e92c2c647c57
nginx-0.0.1-2003-11-05-20:03:41 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 05 Nov 2003 17:03:41 +0000 |
parents | caa57ddf6d77 |
children | c0552e5ab567 |
comparison
equal
deleted
inserted
replaced
174:ea464a6c0581 | 175:e92c2c647c57 |
---|---|
243 | 243 |
244 if (n == 0) { | 244 if (n == 0) { |
245 p->upstream_eof = 1; | 245 p->upstream_eof = 1; |
246 break; | 246 break; |
247 } | 247 } |
248 } | 248 |
249 | 249 } |
250 | |
251 p->read_length += n; | |
250 cl = chain; | 252 cl = chain; |
251 | 253 |
252 while (cl && n > 0) { | 254 while (cl && n > 0) { |
253 | 255 |
254 ngx_event_pipe_remove_shadow_links(cl->hunk); | 256 ngx_event_pipe_remove_shadow_links(cl->hunk); |
399 } | 401 } |
400 | 402 |
401 ngx_chain_update_chains(&p->free, &p->busy, &out, p->tag); | 403 ngx_chain_update_chains(&p->free, &p->busy, &out, p->tag); |
402 | 404 |
403 for (cl = p->free; cl; cl = cl->next) { | 405 for (cl = p->free; cl; cl = cl->next) { |
406 | |
407 if (cl->hunk->type & NGX_HUNK_TEMP_FILE) { | |
408 if (p->cachable || !p->cyclic_temp_file) { | |
409 continue; | |
410 } | |
411 | |
412 /* reset p->temp_offset if all hunks had been sent */ | |
413 | |
414 if (cl->hunk->file_last == p->temp_file->offset) { | |
415 p->temp_file->offset = 0; | |
416 } | |
417 } | |
404 | 418 |
405 /* TODO: free hunk if p->free_bufs && upstream done */ | 419 /* TODO: free hunk if p->free_bufs && upstream done */ |
406 /* add the free shadow raw hunk to p->free_raw_hunks */ | 420 /* add the free shadow raw hunk to p->free_raw_hunks */ |
407 | 421 |
408 if (cl->hunk->type & NGX_HUNK_LAST_SHADOW) { | 422 if (cl->hunk->type & NGX_HUNK_LAST_SHADOW) { |
414 | 428 |
415 cl->hunk->type &= ~NGX_HUNK_LAST_SHADOW; | 429 cl->hunk->type &= ~NGX_HUNK_LAST_SHADOW; |
416 } | 430 } |
417 cl->hunk->shadow = NULL; | 431 cl->hunk->shadow = NULL; |
418 | 432 |
433 #if 0 | |
419 if (p->cyclic_temp_file && (cl->hunk->type & NGX_HUNK_TEMP_FILE)) { | 434 if (p->cyclic_temp_file && (cl->hunk->type & NGX_HUNK_TEMP_FILE)) { |
420 | 435 |
421 /* reset p->temp_offset if all hunks had been sent */ | 436 /* reset p->temp_offset if all hunks had been sent */ |
422 | 437 |
423 if (cl->hunk->file_last == p->temp_file->offset) { | 438 if (cl->hunk->file_last == p->temp_file->offset) { |
424 p->temp_file->offset = 0; | 439 p->temp_file->offset = 0; |
425 } | 440 } |
426 } | 441 } |
442 #endif | |
427 } | 443 } |
428 } | 444 } |
429 | 445 |
430 return NGX_OK; | 446 return NGX_OK; |
431 } | 447 } |
516 h->file = &p->temp_file->file; | 532 h->file = &p->temp_file->file; |
517 h->file_pos = p->temp_file->offset; | 533 h->file_pos = p->temp_file->offset; |
518 p->temp_file->offset += h->last - h->pos; | 534 p->temp_file->offset += h->last - h->pos; |
519 h->file_last = p->temp_file->offset; | 535 h->file_last = p->temp_file->offset; |
520 | 536 |
537 h->type |= NGX_HUNK_FILE|NGX_HUNK_TEMP_FILE; | |
538 | |
539 #if 0 | |
521 if (p->cachable) { | 540 if (p->cachable) { |
522 h->type |= NGX_HUNK_FILE; | 541 h->type |= NGX_HUNK_FILE; |
523 } else { | 542 } else { |
524 h->type |= NGX_HUNK_FILE|NGX_HUNK_TEMP_FILE; | 543 h->type |= NGX_HUNK_FILE|NGX_HUNK_TEMP_FILE; |
525 } | 544 } |
545 #endif | |
526 | 546 |
527 ngx_chain_add_link(p->out, p->last_out, cl); | 547 ngx_chain_add_link(p->out, p->last_out, cl); |
528 | 548 |
529 if (h->type & NGX_HUNK_LAST_SHADOW) { | 549 if (h->type & NGX_HUNK_LAST_SHADOW) { |
530 h->shadow->last = h->shadow->pos = h->shadow->start; | 550 h->shadow->last = h->shadow->pos = h->shadow->start; |