aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2021-04-28 11:30:27 +0300
committerRoman Arutyunyan <arut@nginx.com>2021-04-28 11:30:27 +0300
commit541feb5bd913294c0ef068b03293b67d0da7ef21 (patch)
tree7d4b1a6bef0cddd842e82d719034929530790460 /src
parent9e05c357cc20c6673480e45e554a5b1c69b0e413 (diff)
downloadnginx-541feb5bd913294c0ef068b03293b67d0da7ef21.tar.gz
nginx-541feb5bd913294c0ef068b03293b67d0da7ef21.zip
HTTP/3: clean up table from session cleanup handler.
Previously table had a separate cleanup handler.
Diffstat (limited to 'src')
-rw-r--r--src/http/v3/ngx_http_v3.c2
-rw-r--r--src/http/v3/ngx_http_v3_tables.c29
-rw-r--r--src/http/v3/ngx_http_v3_tables.h1
3 files changed, 13 insertions, 19 deletions
diff --git a/src/http/v3/ngx_http_v3.c b/src/http/v3/ngx_http_v3.c
index 461388bae..a1638c504 100644
--- a/src/http/v3/ngx_http_v3.c
+++ b/src/http/v3/ngx_http_v3.c
@@ -79,6 +79,8 @@ ngx_http_v3_cleanup_session(void *data)
{
ngx_http_v3_session_t *h3c = data;
+ ngx_http_v3_cleanup_table(h3c);
+
if (h3c->keepalive.timer_set) {
ngx_del_timer(&h3c->keepalive);
}
diff --git a/src/http/v3/ngx_http_v3_tables.c b/src/http/v3/ngx_http_v3_tables.c
index f83236c01..e07332c96 100644
--- a/src/http/v3/ngx_http_v3_tables.c
+++ b/src/http/v3/ngx_http_v3_tables.c
@@ -14,7 +14,6 @@
static ngx_int_t ngx_http_v3_evict(ngx_connection_t *c, size_t need);
-static void ngx_http_v3_cleanup_table(void *data);
static void ngx_http_v3_unblock(void *data);
static ngx_int_t ngx_http_v3_new_header(ngx_connection_t *c);
@@ -240,8 +239,6 @@ ngx_int_t
ngx_http_v3_set_capacity(ngx_connection_t *c, ngx_uint_t capacity)
{
ngx_uint_t max, prev_max;
- ngx_connection_t *pc;
- ngx_pool_cleanup_t *cln;
ngx_http_v3_header_t **elts;
ngx_http_v3_session_t *h3c;
ngx_http_v3_srv_conf_t *h3scf;
@@ -276,18 +273,7 @@ ngx_http_v3_set_capacity(ngx_connection_t *c, ngx_uint_t capacity)
return NGX_ERROR;
}
- if (dt->elts == NULL) {
- pc = c->quic->parent;
-
- cln = ngx_pool_cleanup_add(pc->pool, 0);
- if (cln == NULL) {
- return NGX_ERROR;
- }
-
- cln->handler = ngx_http_v3_cleanup_table;
- cln->data = dt;
-
- } else {
+ if (dt->elts) {
ngx_memcpy(elts, dt->elts, dt->nelts * sizeof(void *));
ngx_free(dt->elts);
}
@@ -301,12 +287,17 @@ ngx_http_v3_set_capacity(ngx_connection_t *c, ngx_uint_t capacity)
}
-static void
-ngx_http_v3_cleanup_table(void *data)
+void
+ngx_http_v3_cleanup_table(ngx_http_v3_session_t *h3c)
{
- ngx_http_v3_dynamic_table_t *dt = data;
+ ngx_uint_t n;
+ ngx_http_v3_dynamic_table_t *dt;
+
+ dt = &h3c->table;
- ngx_uint_t n;
+ if (dt->elts == NULL) {
+ return;
+ }
for (n = 0; n < dt->nelts; n++) {
ngx_free(dt->elts[n]);
diff --git a/src/http/v3/ngx_http_v3_tables.h b/src/http/v3/ngx_http_v3_tables.h
index 6cf247541..36589f171 100644
--- a/src/http/v3/ngx_http_v3_tables.h
+++ b/src/http/v3/ngx_http_v3_tables.h
@@ -29,6 +29,7 @@ typedef struct {
} ngx_http_v3_dynamic_table_t;
+void ngx_http_v3_cleanup_table(ngx_http_v3_session_t *h3c);
ngx_int_t ngx_http_v3_ref_insert(ngx_connection_t *c, ngx_uint_t dynamic,
ngx_uint_t index, ngx_str_t *value);
ngx_int_t ngx_http_v3_insert(ngx_connection_t *c, ngx_str_t *name,