# HG changeset patch # User Sergey Kandaurov # Date 1623919435 -10800 # Node ID f5732fa038ad6ef32ff12e8f774df0589ac79ef5 # Parent ae70fcb8ac93c3aa53c5add8345dae17e7ec201b 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. diff -r ae70fcb8ac93 -r f5732fa038ad src/http/modules/ngx_http_grpc_module.c --- a/src/http/modules/ngx_http_grpc_module.c Tue Jun 01 17:37:51 2021 +0300 +++ b/src/http/modules/ngx_http_grpc_module.c Thu Jun 17 11:43:55 2021 +0300 @@ -124,6 +124,7 @@ unsigned done:1; unsigned status:1; unsigned rst:1; + unsigned goaway:1; ngx_http_request_t *request; @@ -1213,6 +1214,7 @@ ctx->done = 0; ctx->status = 0; ctx->rst = 0; + ctx->goaway = 0; ctx->connection = NULL; return NGX_OK; @@ -1568,6 +1570,7 @@ && ctx->out == NULL && ctx->output_closed && !ctx->output_blocked + && !ctx->goaway && ctx->state == ngx_http_grpc_st_start) { u->keepalive = 1; @@ -1717,6 +1720,8 @@ return NGX_HTTP_UPSTREAM_INVALID_HEADER; } + ctx->goaway = 1; + continue; } @@ -1910,6 +1915,7 @@ && ctx->out == NULL && ctx->output_closed && !ctx->output_blocked + && !ctx->goaway && b->last == b->pos) { u->keepalive = 1; @@ -2038,6 +2044,7 @@ if (ctx->in == NULL && ctx->output_closed && !ctx->output_blocked + && !ctx->goaway && ctx->state == ngx_http_grpc_st_start) { u->keepalive = 1; @@ -2207,6 +2214,8 @@ return NGX_ERROR; } + ctx->goaway = 1; + continue; }