~ubuntu-branches/ubuntu/oneiric/nginx/oneiric-updates

« back to all changes in this revision

Viewing changes to src/event/ngx_event_pipe.c

  • Committer: Bazaar Package Importer
  • Author(s): Bhavani Shankar
  • Date: 2010-11-28 08:38:27 UTC
  • mfrom: (4.2.24 sid)
  • Revision ID: james.westby@ubuntu.com-20101128083827-yxc30ucpllbu3h08
Tags: 0.8.53-1ubuntu1
* Merge from debian unstable. Remaining changes:
  - Don't copy the default site directly into /var/www/ in the package,
    but instead keep it in /usr/share/nginx/nginx-default and move it to
   /var/www/nginx-default/ just after installation. (LP: #547267)
* debian/patches/nginx-html5-codecs.diff
  - Add support for html5 codecs (LP: #674224)

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
ngx_event_pipe(ngx_event_pipe_t *p, ngx_int_t do_write)
25
25
{
26
26
    u_int         flags;
 
27
    ngx_int_t     rc;
27
28
    ngx_event_t  *rev, *wev;
28
29
 
29
30
    for ( ;; ) {
30
31
        if (do_write) {
31
32
            p->log->action = "sending to client";
32
33
 
33
 
            if (ngx_event_pipe_write_to_downstream(p) == NGX_ABORT) {
 
34
            rc = ngx_event_pipe_write_to_downstream(p);
 
35
 
 
36
            if (rc == NGX_ABORT) {
34
37
                return NGX_ABORT;
35
38
            }
 
39
 
 
40
            if (rc == NGX_BUSY) {
 
41
                return NGX_OK;
 
42
            }
36
43
        }
37
44
 
38
45
        p->read = 0;
422
429
    u_char            *prev;
423
430
    size_t             bsize;
424
431
    ngx_int_t          rc;
425
 
    ngx_uint_t         flush, prev_last_shadow;
 
432
    ngx_uint_t         flush, flushed, prev_last_shadow;
426
433
    ngx_chain_t       *out, **ll, *cl, file;
427
434
    ngx_connection_t  *downstream;
428
435
 
431
438
    ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0,
432
439
                   "pipe write downstream: %d", downstream->write->ready);
433
440
 
 
441
    flushed = 0;
 
442
 
434
443
    for ( ;; ) {
435
444
        if (p->downstream_error) {
436
445
            return ngx_event_pipe_drain_chains(p);
454
463
 
455
464
                rc = p->output_filter(p->output_ctx, p->out);
456
465
 
457
 
                if (downstream->destroyed) {
458
 
                    return NGX_ABORT;
459
 
                }
460
 
 
461
466
                if (rc == NGX_ERROR) {
462
467
                    p->downstream_error = 1;
463
468
                    return ngx_event_pipe_drain_chains(p);
476
481
 
477
482
                rc = p->output_filter(p->output_ctx, p->in);
478
483
 
479
 
                if (downstream->destroyed) {
480
 
                    return NGX_ABORT;
481
 
                }
482
 
 
483
484
                if (rc == NGX_ERROR) {
484
485
                    p->downstream_error = 1;
485
486
                    return ngx_event_pipe_drain_chains(p);
618
619
        ngx_log_debug2(NGX_LOG_DEBUG_EVENT, p->log, 0,
619
620
                       "pipe write: out:%p, f:%d", out, flush);
620
621
 
621
 
        if (out == NULL && !flush) {
622
 
            break;
 
622
        if (out == NULL) {
 
623
 
 
624
            if (!flush) {
 
625
                break;
 
626
            }
 
627
 
 
628
            /* a workaround for AIO */
 
629
            if (flushed++ > 10) {
 
630
                return NGX_BUSY;
 
631
            }
623
632
        }
624
633
 
625
634
        rc = p->output_filter(p->output_ctx, out);
626
635
 
627
 
        if (downstream->destroyed) {
628
 
            return NGX_ABORT;
629
 
        }
630
 
 
631
636
        if (rc == NGX_ERROR) {
632
637
            p->downstream_error = 1;
633
638
            return ngx_event_pipe_drain_chains(p);