HTTP/2: keepalive_timeout now armed once between requests.

Previously, PINGs and other frames extended possible keepalive time,
making it possible to keep an open HTTP/2 connection for a long time.
Now the connection is always closed as long as keepalive_timeout expires,
similarly to how it happens in HTTP/1.x.

Note that as a part of this change, incomplete frames are no longer
trigger a separate timeout, so http2_recv_timeout (replaced by
client_header_timeout in previous patches) is essentially cancelled.
The client_header_timeout is, however, used for SSL handshake and
while reading HEADERS frames.
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c
index 071fadb..e57c65c 100644
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -325,6 +325,10 @@
     rev->handler = ngx_http_v2_read_handler;
     c->write->handler = ngx_http_v2_write_handler;
 
+    if (c->read->timer_set) {
+        ngx_del_timer(c->read);
+    }
+
     c->idle = 1;
     ngx_reusable_connection(c, 0);
 
@@ -455,14 +459,6 @@
 
     h2c->blocked = 0;
 
-    if (h2c->processing || h2c->pushing) {
-        if (rev->timer_set) {
-            ngx_del_timer(rev);
-        }
-
-        return;
-    }
-
     ngx_http_v2_handle_connection(h2c);
 }
 
@@ -638,7 +634,6 @@
     ngx_int_t                  rc;
     ngx_connection_t          *c;
     ngx_http_core_loc_conf_t  *clcf;
-    ngx_http_core_srv_conf_t  *cscf;
 
     if (h2c->last_out || h2c->processing || h2c->pushing) {
         return;
@@ -675,15 +670,16 @@
         return;
     }
 
+    clcf = ngx_http_get_module_loc_conf(h2c->http_connection->conf_ctx,
+                                        ngx_http_core_module);
+
+    if (!c->read->timer_set) {
+        ngx_add_timer(c->read, clcf->keepalive_timeout);
+    }
+
     ngx_reusable_connection(c, 1);
 
     if (h2c->state.incomplete) {
-        if (!c->read->timer_set) {
-            cscf = ngx_http_get_module_srv_conf(h2c->http_connection->conf_ctx,
-                                                ngx_http_core_module);
-            ngx_add_timer(c->read, cscf->client_header_timeout);
-        }
-
         return;
     }
 
@@ -708,11 +704,6 @@
     if (c->write->timer_set) {
         ngx_del_timer(c->write);
     }
-
-    clcf = ngx_http_get_module_loc_conf(h2c->http_connection->conf_ctx,
-                                        ngx_http_core_module);
-
-    ngx_add_timer(c->read, clcf->keepalive_timeout);
 }
 
 
@@ -3298,6 +3289,10 @@
 
     h2c->priority_limit += h2scf->concurrent_streams;
 
+    if (h2c->connection->read->timer_set) {
+        ngx_del_timer(h2c->connection->read);
+    }
+
     return stream;
 }
 
@@ -4709,10 +4704,6 @@
     c->destroyed = 0;
     ngx_reusable_connection(c, 0);
 
-    if (c->read->timer_set) {
-        ngx_del_timer(c->read);
-    }
-
     h2scf = ngx_http_get_module_srv_conf(h2c->http_connection->conf_ctx,
                                          ngx_http_v2_module);