mirror of
https://github.com/nginx/nginx.git
synced 2025-07-25 22:56:59 +08:00
gRPC: handling GOAWAY with a higher last stream identifier.
Previously, once received from upstream, it couldn't limit opening additional streams in a cached keepalive connection.
This commit is contained in:
parent
63572fce55
commit
3985c5bfdc
@ -124,6 +124,7 @@ typedef struct {
|
|||||||
unsigned done:1;
|
unsigned done:1;
|
||||||
unsigned status:1;
|
unsigned status:1;
|
||||||
unsigned rst:1;
|
unsigned rst:1;
|
||||||
|
unsigned goaway:1;
|
||||||
|
|
||||||
ngx_http_request_t *request;
|
ngx_http_request_t *request;
|
||||||
|
|
||||||
@ -1213,6 +1214,7 @@ ngx_http_grpc_reinit_request(ngx_http_request_t *r)
|
|||||||
ctx->done = 0;
|
ctx->done = 0;
|
||||||
ctx->status = 0;
|
ctx->status = 0;
|
||||||
ctx->rst = 0;
|
ctx->rst = 0;
|
||||||
|
ctx->goaway = 0;
|
||||||
ctx->connection = NULL;
|
ctx->connection = NULL;
|
||||||
|
|
||||||
return NGX_OK;
|
return NGX_OK;
|
||||||
@ -1568,6 +1570,7 @@ ngx_http_grpc_body_output_filter(void *data, ngx_chain_t *in)
|
|||||||
&& ctx->out == NULL
|
&& ctx->out == NULL
|
||||||
&& ctx->output_closed
|
&& ctx->output_closed
|
||||||
&& !ctx->output_blocked
|
&& !ctx->output_blocked
|
||||||
|
&& !ctx->goaway
|
||||||
&& ctx->state == ngx_http_grpc_st_start)
|
&& ctx->state == ngx_http_grpc_st_start)
|
||||||
{
|
{
|
||||||
u->keepalive = 1;
|
u->keepalive = 1;
|
||||||
@ -1717,6 +1720,8 @@ ngx_http_grpc_process_header(ngx_http_request_t *r)
|
|||||||
return NGX_HTTP_UPSTREAM_INVALID_HEADER;
|
return NGX_HTTP_UPSTREAM_INVALID_HEADER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx->goaway = 1;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1910,6 +1915,7 @@ ngx_http_grpc_process_header(ngx_http_request_t *r)
|
|||||||
&& ctx->out == NULL
|
&& ctx->out == NULL
|
||||||
&& ctx->output_closed
|
&& ctx->output_closed
|
||||||
&& !ctx->output_blocked
|
&& !ctx->output_blocked
|
||||||
|
&& !ctx->goaway
|
||||||
&& b->last == b->pos)
|
&& b->last == b->pos)
|
||||||
{
|
{
|
||||||
u->keepalive = 1;
|
u->keepalive = 1;
|
||||||
@ -2038,6 +2044,7 @@ ngx_http_grpc_filter(void *data, ssize_t bytes)
|
|||||||
if (ctx->in == NULL
|
if (ctx->in == NULL
|
||||||
&& ctx->output_closed
|
&& ctx->output_closed
|
||||||
&& !ctx->output_blocked
|
&& !ctx->output_blocked
|
||||||
|
&& !ctx->goaway
|
||||||
&& ctx->state == ngx_http_grpc_st_start)
|
&& ctx->state == ngx_http_grpc_st_start)
|
||||||
{
|
{
|
||||||
u->keepalive = 1;
|
u->keepalive = 1;
|
||||||
@ -2207,6 +2214,8 @@ ngx_http_grpc_filter(void *data, ssize_t bytes)
|
|||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx->goaway = 1;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user