Mercurial > hg > nginx
comparison src/event/ngx_event_pipe.c @ 187:5a9bbe99008b
nginx-0.0.1-2003-11-17-19:15:03 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 17 Nov 2003 16:15:03 +0000 |
parents | c1f3a3c7c5db |
children | 0061d1f0908d |
comparison
equal
deleted
inserted
replaced
186:c1f3a3c7c5db | 187:5a9bbe99008b |
---|---|
449 | 449 |
450 | 450 |
451 static int ngx_event_pipe_write_chain_to_temp_file(ngx_event_pipe_t *p) | 451 static int ngx_event_pipe_write_chain_to_temp_file(ngx_event_pipe_t *p) |
452 { | 452 { |
453 int size, hsize; | 453 int size, hsize; |
454 char *save_pos; | |
455 ngx_hunk_t *h; | 454 ngx_hunk_t *h; |
456 ngx_chain_t *cl, *tl, *next, *out, **ll, **last_free; | 455 ngx_chain_t *cl, *tl, *next, *out, **ll, **last_free, fl; |
457 | 456 |
458 ngx_log_debug(p->log, "write to file"); | 457 if (p->hunk_to_file) { |
459 | 458 fl.hunk = p->hunk_to_file; |
460 out = p->in; | 459 fl.next = p->in; |
461 | 460 out = &fl; |
462 if (out->hunk->type & NGX_HUNK_PREREAD) { | |
463 save_pos = out->hunk->pos; | |
464 out->hunk->pos = out->hunk->start; | |
465 | 461 |
466 } else { | 462 } else { |
467 save_pos = NULL; | 463 out = p->in; |
468 } | 464 } |
469 | 465 |
470 if (!p->cachable) { | 466 if (!p->cachable) { |
471 | 467 |
472 size = 0; | 468 size = 0; |
473 cl = p->in; | 469 cl = out; |
474 ll = NULL; | 470 ll = NULL; |
475 | 471 |
476 ngx_log_debug(p->log, "offset: %d" _ p->temp_file->offset); | 472 ngx_log_debug(p->log, "offset: %d" _ p->temp_file->offset); |
477 | 473 |
478 do { | 474 do { |
517 last_free = &(*last_free)->next) | 513 last_free = &(*last_free)->next) |
518 { | 514 { |
519 /* void */ | 515 /* void */ |
520 } | 516 } |
521 | 517 |
522 if (out->hunk->type & NGX_HUNK_PREREAD) { | 518 if (p->hunk_to_file) { |
523 p->temp_file->offset += save_pos - out->hunk->pos; | 519 p->temp_file->offset = p->hunk_to_file->last - p->hunk_to_file->pos; |
524 out->hunk->pos = save_pos; | 520 p->hunk_to_file = NULL; |
525 out->hunk->type &= ~NGX_HUNK_PREREAD; | 521 out = out->next; |
526 } | 522 } |
527 | 523 |
528 for (cl = out; cl; cl = next) { | 524 for (cl = out; cl; cl = next) { |
529 next = cl->next; | 525 next = cl->next; |
530 cl->next = NULL; | 526 cl->next = NULL; |
563 | 559 |
564 int ngx_event_pipe_copy_input_filter(ngx_event_pipe_t *p, ngx_hunk_t *hunk) | 560 int ngx_event_pipe_copy_input_filter(ngx_event_pipe_t *p, ngx_hunk_t *hunk) |
565 { | 561 { |
566 ngx_hunk_t *h; | 562 ngx_hunk_t *h; |
567 ngx_chain_t *cl; | 563 ngx_chain_t *cl; |
568 | |
569 ngx_log_debug(p->log, "COPY"); | |
570 | 564 |
571 if (hunk->pos == hunk->last) { | 565 if (hunk->pos == hunk->last) { |
572 return NGX_OK; | 566 return NGX_OK; |
573 } | 567 } |
574 | 568 |