aboutsummaryrefslogtreecommitdiff
path: root/src/http/v3/ngx_http_v3_request.c
diff options
context:
space:
mode:
authorSergey Kandaurov <pluknet@nginx.com>2021-04-16 19:42:03 +0300
committerSergey Kandaurov <pluknet@nginx.com>2021-04-16 19:42:03 +0300
commit2fd50ca589d37b4dd66006254d99918f44617cf0 (patch)
treefe03cf448f38c9ab0e5b908a1fc0664b2b9f8c41 /src/http/v3/ngx_http_v3_request.c
parentf29e48f7eed3e0593098818b42bd17dee17cc601 (diff)
downloadnginx-2fd50ca589d37b4dd66006254d99918f44617cf0.tar.gz
nginx-2fd50ca589d37b4dd66006254d99918f44617cf0.zip
HTTP/3: keepalive_time support.
Diffstat (limited to 'src/http/v3/ngx_http_v3_request.c')
-rw-r--r--src/http/v3/ngx_http_v3_request.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/http/v3/ngx_http_v3_request.c b/src/http/v3/ngx_http_v3_request.c
index 4dc673078..c459efef5 100644
--- a/src/http/v3/ngx_http_v3_request.c
+++ b/src/http/v3/ngx_http_v3_request.c
@@ -81,15 +81,22 @@ ngx_http_v3_init(ngx_connection_t *c)
clcf = ngx_http_get_module_loc_conf(hc->conf_ctx, ngx_http_core_module);
- n = c->quic->id >> 2;
+ h3c = c->quic->parent->data;
- if (n >= clcf->keepalive_requests) {
+ if (h3c->goaway) {
ngx_quic_reset_stream(c, NGX_HTTP_V3_ERR_REQUEST_REJECTED);
ngx_http_close_connection(c);
return;
}
- if (n + 1 == clcf->keepalive_requests) {
+ n = c->quic->id >> 2;
+
+ if (n + 1 == clcf->keepalive_requests
+ || ngx_current_msec - c->quic->parent->start_time
+ > clcf->keepalive_time)
+ {
+ h3c->goaway = 1;
+
if (ngx_http_v3_send_goaway(c, (n + 1) << 2) != NGX_OK) {
ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_INTERNAL_ERROR,
"goaway error");
@@ -110,7 +117,6 @@ ngx_http_v3_init(ngx_connection_t *c)
cln->handler = ngx_http_v3_cleanup_request;
cln->data = c;
- h3c = c->quic->parent->data;
h3c->nrequests++;
if (h3c->keepalive.timer_set) {