Mercurial > hg > nginx-quic
comparison src/event/ngx_event_pipe.c @ 1728:412742b3e60e stable-0.5
r1626 merge:
fix segfaults
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 12 Dec 2007 20:59:58 +0000 |
parents | 6b81bbc36eaf |
children |
comparison
equal
deleted
inserted
replaced
1727:15042ebc34fb | 1728:412742b3e60e |
---|---|
419 static ngx_int_t | 419 static ngx_int_t |
420 ngx_event_pipe_write_to_downstream(ngx_event_pipe_t *p) | 420 ngx_event_pipe_write_to_downstream(ngx_event_pipe_t *p) |
421 { | 421 { |
422 u_char *prev; | 422 u_char *prev; |
423 size_t bsize; | 423 size_t bsize; |
424 ngx_int_t rc; | |
424 ngx_uint_t flush, prev_last_shadow; | 425 ngx_uint_t flush, prev_last_shadow; |
425 ngx_chain_t *out, **ll, *cl; | 426 ngx_chain_t *out, **ll, *cl; |
426 ngx_connection_t *downstream; | 427 ngx_connection_t *downstream; |
427 | 428 |
428 downstream = p->downstream; | 429 downstream = p->downstream; |
449 | 450 |
450 for (cl = p->out; cl; cl = cl->next) { | 451 for (cl = p->out; cl; cl = cl->next) { |
451 cl->buf->recycled = 0; | 452 cl->buf->recycled = 0; |
452 } | 453 } |
453 | 454 |
454 if (p->output_filter(p->output_ctx, p->out) == NGX_ERROR) { | 455 rc = p->output_filter(p->output_ctx, p->out); |
456 | |
457 if (downstream->destroyed) { | |
458 return NGX_ABORT; | |
459 } | |
460 | |
461 if (rc == NGX_ERROR) { | |
455 p->downstream_error = 1; | 462 p->downstream_error = 1; |
456 return ngx_event_pipe_drain_chains(p); | 463 return ngx_event_pipe_drain_chains(p); |
457 } | 464 } |
458 | 465 |
459 p->out = NULL; | 466 p->out = NULL; |
465 | 472 |
466 for (cl = p->in; cl; cl = cl->next) { | 473 for (cl = p->in; cl; cl = cl->next) { |
467 cl->buf->recycled = 0; | 474 cl->buf->recycled = 0; |
468 } | 475 } |
469 | 476 |
470 if (p->output_filter(p->output_ctx, p->in) == NGX_ERROR) { | 477 rc = p->output_filter(p->output_ctx, p->in); |
471 | 478 |
472 if (downstream->destroyed) { | 479 if (downstream->destroyed) { |
473 return NGX_ABORT; | 480 return NGX_ABORT; |
474 } | 481 } |
475 | 482 |
483 if (rc == NGX_ERROR) { | |
476 p->downstream_error = 1; | 484 p->downstream_error = 1; |
477 return ngx_event_pipe_drain_chains(p); | 485 return ngx_event_pipe_drain_chains(p); |
478 } | 486 } |
479 | 487 |
480 p->in = NULL; | 488 p->in = NULL; |
600 | 608 |
601 if (out == NULL && !flush) { | 609 if (out == NULL && !flush) { |
602 break; | 610 break; |
603 } | 611 } |
604 | 612 |
605 if (p->output_filter(p->output_ctx, out) == NGX_ERROR) { | 613 rc = p->output_filter(p->output_ctx, out); |
614 | |
615 if (downstream->destroyed) { | |
616 return NGX_ABORT; | |
617 } | |
618 | |
619 if (rc == NGX_ERROR) { | |
606 p->downstream_error = 1; | 620 p->downstream_error = 1; |
607 return ngx_event_pipe_drain_chains(p); | 621 return ngx_event_pipe_drain_chains(p); |
608 } | 622 } |
609 | 623 |
610 ngx_chain_update_chains(&p->free, &p->busy, &out, p->tag); | 624 ngx_chain_update_chains(&p->free, &p->busy, &out, p->tag); |