comparison src/http/v2/ngx_http_v2.c @ 7805:ade8160120c1

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 26 Mar 2021 01:44:57 +0300
parents 171682010da4
children 3674d5b7174e
comparison
equal deleted inserted replaced
7804:4a9d28f8f39e 7805:ade8160120c1
1366 } 1366 }
1367 1367
1368 clcf = ngx_http_get_module_loc_conf(h2c->http_connection->conf_ctx, 1368 clcf = ngx_http_get_module_loc_conf(h2c->http_connection->conf_ctx,
1369 ngx_http_core_module); 1369 ngx_http_core_module);
1370 1370
1371 if (h2c->connection->requests >= clcf->keepalive_requests) { 1371 if (clcf->keepalive_timeout == 0
1372 || h2c->connection->requests >= clcf->keepalive_requests)
1373 {
1372 h2c->goaway = 1; 1374 h2c->goaway = 1;
1373 1375
1374 if (ngx_http_v2_send_goaway(h2c, NGX_HTTP_V2_NO_ERROR) == NGX_ERROR) { 1376 if (ngx_http_v2_send_goaway(h2c, NGX_HTTP_V2_NO_ERROR) == NGX_ERROR) {
1375 return ngx_http_v2_connection_error(h2c, 1377 return ngx_http_v2_connection_error(h2c,
1376 NGX_HTTP_V2_INTERNAL_ERROR); 1378 NGX_HTTP_V2_INTERNAL_ERROR);