Klaus Demo nginx / b540af6
gRPC: disabled keepalive when sending control frames was blocked. If sending request body was not completed (u->request_body_sent is not set), the upstream keepalive module won't save such a connection. However, it is theoretically possible (though highly unlikely) that sending of some control frames can be blocked after the request body was sent. The ctx->output_blocked flag introduced to disable keepalive in such cases. Maxim Dounin 2 years ago
1 changed file(s) with 12 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
111111
112112 unsigned header_sent:1;
113113 unsigned output_closed:1;
114 unsigned output_blocked:1;
114115 unsigned parsing_headers:1;
115116 unsigned end_stream:1;
116117 unsigned done:1;
10751076 ctx->state = 0;
10761077 ctx->header_sent = 0;
10771078 ctx->output_closed = 0;
1079 ctx->output_blocked = 0;
10781080 ctx->parsing_headers = 0;
10791081 ctx->end_stream = 0;
10801082 ctx->done = 0;
14121414 rc = NGX_AGAIN;
14131415 }
14141416
1417 if (rc == NGX_AGAIN) {
1418 ctx->output_blocked = 1;
1419
1420 } else {
1421 ctx->output_blocked = 0;
1422 }
1423
14151424 if (ctx->done) {
14161425
14171426 /*
14261435 if (ctx->in == NULL
14271436 && ctx->out == NULL
14281437 && ctx->output_closed
1438 && !ctx->output_blocked
14291439 && ctx->state == ngx_http_grpc_st_start)
14301440 {
14311441 u->keepalive = 1;
17761786 if (ctx->in == NULL
17771787 && ctx->out == NULL
17781788 && ctx->output_closed
1789 && !ctx->output_blocked
17791790 && b->last == b->pos)
17801791 {
17811792 u->keepalive = 1;
18781889
18791890 if (ctx->in == NULL
18801891 && ctx->output_closed
1892 && !ctx->output_blocked
18811893 && ctx->state == ngx_http_grpc_st_start)
18821894 {
18831895 u->keepalive = 1;