comparison src/event/ngx_event_pipe.c @ 1039:73f18b6ad6ba

fix FastCGI "zero size buf" alert, r841 did not fix it
author Igor Sysoev <igor@sysoev.ru>
date Wed, 17 Jan 2007 16:10:40 +0000
parents 5a86fcc480c6
children d536a2332385
comparison
equal deleted inserted replaced
1038:c136df6c5ff0 1039:73f18b6ad6ba
418 418
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 size_t bsize; 422 size_t bsize;
423 ngx_uint_t flush; 423 ngx_uint_t flush, prev_last_shadow;
424 ngx_chain_t *out, **ll, *cl; 424 ngx_chain_t *out, **ll, *cl;
425 ngx_connection_t *downstream; 425 ngx_connection_t *downstream;
426 426
427 downstream = p->downstream; 427 downstream = p->downstream;
428 428
509 "pipe write busy: %uz", bsize); 509 "pipe write busy: %uz", bsize);
510 510
511 out = NULL; 511 out = NULL;
512 ll = NULL; 512 ll = NULL;
513 flush = 0; 513 flush = 0;
514 prev_last_shadow = 1;
514 515
515 for ( ;; ) { 516 for ( ;; ) {
516 if (p->out) { 517 if (p->out) {
517 cl = p->out; 518 cl = p->out;
518 519
519 if (cl->buf->recycled 520 if (cl->buf->recycled
520 && cl->buf->last_shadow 521 && cl->buf->last_shadow
521 && bsize + cl->buf->last - cl->buf->pos > p->busy_size) 522 && bsize + cl->buf->last - cl->buf->pos > p->busy_size)
522 { 523 {
524 if (!prev_last_shadow) {
525 p->in = p->in->next;
526 }
527
523 flush = 1; 528 flush = 1;
524 break; 529 break;
525 } 530 }
531
532 prev_last_shadow = cl->buf->last_shadow;
526 533
527 p->out = p->out->next; 534 p->out = p->out->next;
528 535
529 ngx_event_pipe_free_shadow_raw_buf(&p->free_raw_bufs, cl->buf); 536 ngx_event_pipe_free_shadow_raw_buf(&p->free_raw_bufs, cl->buf);
530 537
539 546
540 if (cl->buf->recycled 547 if (cl->buf->recycled
541 && cl->buf->last_shadow 548 && cl->buf->last_shadow
542 && bsize + cl->buf->last - cl->buf->pos > p->busy_size) 549 && bsize + cl->buf->last - cl->buf->pos > p->busy_size)
543 { 550 {
551 if (!prev_last_shadow) {
552 p->in = p->in->next;
553 }
554
544 flush = 1; 555 flush = 1;
545 break; 556 break;
546 } 557 }
558
559 prev_last_shadow = cl->buf->last_shadow;
547 560
548 p->in = p->in->next; 561 p->in = p->in->next;
549 562
550 } else { 563 } else {
551 break; 564 break;