Changeset 7231:22f7bdbd96d3 in nginx


Ignore:
Timestamp:
03/17/18 20:04:22 (2 years ago)
Author:
Maxim Dounin <mdounin@…>
Branch:
default
Phase:
public
Message:

Upstream: u->request_body_blocked flag.

The flag indicates whether last ngx_output_chain() returned NGX_AGAIN
or not. If the flag is set, we arm the u->conf->send_timeout timer.
The flag complements c->write->ready test, and allows to stop sending
the request body in an output filter due to protocol-specific flow
control.

Location:
src/http
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/http/ngx_http_upstream.c

    r7230 r7231  
    16171617    u->request_sent = 0;
    16181618    u->request_body_sent = 0;
     1619    u->request_body_blocked = 0;
    16191620
    16201621    if (rc == NGX_AGAIN) {
     
    19951996
    19961997    if (rc == NGX_AGAIN) {
    1997         if (!c->write->ready) {
     1998        if (!c->write->ready || u->request_body_blocked) {
    19981999            ngx_add_timer(c->write, u->conf->send_timeout);
    19992000
     
    20722073        }
    20732074
    2074         return ngx_output_chain(&u->output, out);
     2075        rc = ngx_output_chain(&u->output, out);
     2076
     2077        if (rc == NGX_AGAIN) {
     2078            u->request_body_blocked = 1;
     2079
     2080        } else {
     2081            u->request_body_blocked = 0;
     2082        }
     2083
     2084        return rc;
    20752085    }
    20762086
     
    21112121                out = out->next;
    21122122                ngx_free_chain(r->pool, ln);
     2123            }
     2124
     2125            if (rc == NGX_AGAIN) {
     2126                u->request_body_blocked = 1;
     2127
     2128            } else {
     2129                u->request_body_blocked = 0;
    21132130            }
    21142131
  • src/http/ngx_http_upstream.h

    r7230 r7231  
    392392    unsigned                         request_sent:1;
    393393    unsigned                         request_body_sent:1;
     394    unsigned                         request_body_blocked:1;
    394395    unsigned                         header_sent:1;
    395396};
Note: See TracChangeset for help on using the changeset viewer.