diff src/http/v2/ngx_http_v2.c @ 7820:fdc3d40979b0

Introduced the "keepalive_time" directive. Similar to lingering_time, it limits total connection lifetime before keepalive is switched off. The default is 1 hour, which is close to the total maximum connection lifetime possible with default keepalive_requests and keepalive_timeout.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 08 Apr 2021 00:15:48 +0300
parents 3674d5b7174e
children 63c66b7cc07c
line wrap: on
line diff
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -1369,7 +1369,9 @@ ngx_http_v2_state_headers(ngx_http_v2_co
                                         ngx_http_core_module);
 
     if (clcf->keepalive_timeout == 0
-        || h2c->connection->requests >= clcf->keepalive_requests)
+        || h2c->connection->requests >= clcf->keepalive_requests
+        || ngx_current_msec - h2c->connection->start_time
+           > clcf->keepalive_time)
     {
         h2c->goaway = 1;