]> git.kaiwu.me - nginx.git/commitdiff
HTTP/3: fixed $connection_time.
authorSergey Kandaurov <pluknet@nginx.com>
Tue, 10 Jan 2023 13:59:16 +0000 (17:59 +0400)
committerSergey Kandaurov <pluknet@nginx.com>
Tue, 10 Jan 2023 13:59:16 +0000 (17:59 +0400)
Previously, start_time wasn't set for a new stream.
The fix is to derive it from the parent connection.
Also it's used to simplify tracking keepalive_time.

src/event/quic/ngx_event_quic_streams.c
src/http/v3/ngx_http_v3_request.c

index 2b613ac746ae0f14ebd5d4ada6e2c850f87b44eb..7856255472b3e14954fb92d723b371ff8d1c8214 100644 (file)
@@ -682,6 +682,7 @@ ngx_quic_create_stream(ngx_connection_t *c, uint64_t id)
     sc->local_sockaddr = c->local_sockaddr;
     sc->local_socklen = c->local_socklen;
     sc->number = ngx_atomic_fetch_add(ngx_connection_counter, 1);
+    sc->start_time = c->start_time;
     sc->tcp_nodelay = NGX_TCP_NODELAY_DISABLED;
 
     sc->recv = ngx_quic_stream_recv;
index f0519890337c079844139caf9caffaaa6f24cf83..8a5aeeb142a62e58a150089aaa19a307dd85235c 100644 (file)
@@ -165,7 +165,6 @@ ngx_http_v3_init_request_stream(ngx_connection_t *c)
 {
     uint64_t                   n;
     ngx_event_t               *rev;
-    ngx_connection_t          *pc;
     ngx_pool_cleanup_t        *cln;
     ngx_http_connection_t     *hc;
     ngx_http_v3_session_t     *h3c;
@@ -199,12 +198,10 @@ ngx_http_v3_init_request_stream(ngx_connection_t *c)
         return;
     }
 
-    pc = c->quic->parent;
-
     h3c->next_request_id = c->quic->id + 0x04;
 
     if (n + 1 == clcf->keepalive_requests
-        || ngx_current_msec - pc->start_time > clcf->keepalive_time)
+        || ngx_current_msec - c->start_time > clcf->keepalive_time)
     {
         h3c->goaway = 1;