# HG changeset patch # User Maxim Dounin # Date 1616712297 -10800 # Node ID ade8160120c1d1138a0b1aaf275f02700469ab6c # Parent 4a9d28f8f39e2f782b6fe7acf6a785ab8fff3dff HTTP/2: improved handling of "keepalive_timeout 0". Without explicit handling, a zero timer was actually added, leading to multiple unneeded syscalls. Further, sending GOAWAY frame early might be beneficial for clients. Reported by Sergey Kandaurov. diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c --- a/src/http/v2/ngx_http_v2.c +++ b/src/http/v2/ngx_http_v2.c @@ -1368,7 +1368,9 @@ ngx_http_v2_state_headers(ngx_http_v2_co clcf = ngx_http_get_module_loc_conf(h2c->http_connection->conf_ctx, ngx_http_core_module); - if (h2c->connection->requests >= clcf->keepalive_requests) { + if (clcf->keepalive_timeout == 0 + || h2c->connection->requests >= clcf->keepalive_requests) + { h2c->goaway = 1; if (ngx_http_v2_send_goaway(h2c, NGX_HTTP_V2_NO_ERROR) == NGX_ERROR) {