comparison src/event/ngx_event_pipe.c @ 284:3dbecd747fbb NGINX_0_5_12

nginx 0.5.12 *) Bugfix: nginx could not be built on platforms different from i386, amd64, sparc и ppc; bug appeared in 0.5.8. *) Bugfix: a segmentation fault might occur in worker process if the temporarily files were used while working with FastCGI server; bug appeared in 0.5.8. *) Bugfix: a segmentation fault might occur in worker process if the $fastcgi_script_name variable was logged. *) Bugfix: ngx_http_perl_module could not be built on Solaris.
author Igor Sysoev <http://sysoev.ru>
date Mon, 12 Feb 2007 00:00:00 +0300
parents c5c2b2883984
children 10cc350ed8a1
comparison
equal deleted inserted replaced
283:48810289fcb1 284:3dbecd747fbb
417 417
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 u_char *prev;
422 size_t bsize; 423 size_t bsize;
423 ngx_uint_t flush, prev_last_shadow; 424 ngx_uint_t flush, prev_last_shadow;
424 ngx_chain_t *out, **ll, *cl; 425 ngx_chain_t *out, **ll, *cl;
425 ngx_connection_t *downstream; 426 ngx_connection_t *downstream;
426 427
495 break; 496 break;
496 } 497 }
497 498
498 /* bsize is the size of the busy recycled bufs */ 499 /* bsize is the size of the busy recycled bufs */
499 500
501 prev = NULL;
500 bsize = 0; 502 bsize = 0;
501 503
502 for (cl = p->busy; cl; cl = cl->next) { 504 for (cl = p->busy; cl; cl = cl->next) {
505
503 if (cl->buf->recycled) { 506 if (cl->buf->recycled) {
507 if (prev == cl->buf->start) {
508 continue;
509 }
510
504 bsize += cl->buf->end - cl->buf->start; 511 bsize += cl->buf->end - cl->buf->start;
512 prev = cl->buf->start;
505 } 513 }
506 } 514 }
507 515
508 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, 516 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0,
509 "pipe write busy: %uz", bsize); 517 "pipe write busy: %uz", bsize);
510 518
511 out = NULL; 519 out = NULL;
520
521 if (bsize >= (size_t) p->busy_size) {
522 flush = 1;
523 goto flush;
524 }
525
526 flush = 0;
512 ll = NULL; 527 ll = NULL;
513 flush = 0;
514 prev_last_shadow = 1; 528 prev_last_shadow = 1;
515 529
516 for ( ;; ) { 530 for ( ;; ) {
517 if (p->out) { 531 if (p->out) {
518 cl = p->out; 532 cl = p->out;
577 out = cl; 591 out = cl;
578 } 592 }
579 ll = &cl->next; 593 ll = &cl->next;
580 } 594 }
581 595
596 flush:
597
582 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, p->log, 0, 598 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, p->log, 0,
583 "pipe write: out:%p, f:%d", out, flush); 599 "pipe write: out:%p, f:%d", out, flush);
584 600
585 if (out == NULL && !flush) { 601 if (out == NULL && !flush) {
586 break; 602 break;