diff options
author | Jan Hák <jan.hak@nic.cz> | 2024-11-26 12:56:51 +0100 |
---|---|---|
committer | Daniel Salzman <daniel.salzman@nic.cz> | 2024-12-11 17:36:20 +0100 |
commit | d459590fd6164d5cafab8e0e8dc857864ff4a6ed (patch) | |
tree | 140f78d8ab547338c1dbfd3f59dce62edcfe3df4 | |
parent | kxdpgun: fix usage of new atomic in code (variables stats_trigger and stats_s... (diff) | |
download | knot-d459590fd6164d5cafab8e0e8dc857864ff4a6ed.tar.xz knot-d459590fd6164d5cafab8e0e8dc857864ff4a6ed.zip |
libknot/quic: fix usage of new atomic in code (variable obufs_size)
-rw-r--r-- | src/libknot/quic/quic_conn.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libknot/quic/quic_conn.c b/src/libknot/quic/quic_conn.c index 4cd9d03e3..85cce5849 100644 --- a/src/libknot/quic/quic_conn.c +++ b/src/libknot/quic/quic_conn.c @@ -60,6 +60,7 @@ knot_quic_table_t *knot_quic_table_new(size_t max_conns, size_t max_ibufs, size_ res->max_conns = max_conns; res->ibufs_max = max_ibufs; res->obufs_max = max_obufs; + ATOMIC_INIT(res->obufs_size, 0); res->udp_payload_limit = udp_payload; int ret = gnutls_priority_init2(&res->priority, KNOT_TLS_PRIORITIES, NULL, @@ -99,7 +100,9 @@ void knot_quic_table_free(knot_quic_table_t *table) assert(table->usage == 0); assert(table->pointers == 0); assert(table->ibufs_size == 0); - assert(table->obufs_size == 0); + assert(ATOMIC_GET(table->obufs_size) == 0); + + ATOMIC_DEINIT(table->obufs_size); gnutls_priority_deinit(table->priority); heap_deinit(table->expiry_heap); @@ -134,7 +137,7 @@ void knot_quic_table_sweep(knot_quic_table_t *table, struct knot_quic_reply *swe knot_sweep_stats_incr(stats, KNOT_SWEEP_CTR_LIMIT_CONN); send_excessive_load(c, sweep_reply, table); knot_quic_table_rem(c, table); - } else if (table->obufs_size > table->obufs_max) { + } else if (ATOMIC_GET(table->obufs_size) > table->obufs_max) { knot_sweep_stats_incr(stats, KNOT_SWEEP_CTR_LIMIT_OBUF); send_excessive_load(c, sweep_reply, table); knot_quic_table_rem(c, table); |