diff options
author | Vladimir Homutov <vl@nginx.com> | 2021-10-13 14:48:33 +0300 |
---|---|---|
committer | Vladimir Homutov <vl@nginx.com> | 2021-10-13 14:48:33 +0300 |
commit | 9ca3a02e684a3b5f19b6fec5b486d59eb4a4b319 (patch) | |
tree | 443ad6bf1dc95ed79fc0f1a22f3209dd98886e6c /src | |
parent | 0572c2a69f4edef04e3babdb6f9ef18ff52a9619 (diff) | |
download | nginx-9ca3a02e684a3b5f19b6fec5b486d59eb4a4b319.tar.gz nginx-9ca3a02e684a3b5f19b6fec5b486d59eb4a4b319.zip |
QUIC: fixed removal of unused client IDs.
If client ID was never used, its refcount is zero. To keep things simple,
the ngx_quic_unref_client_id() function is now aware of such IDs.
If client ID was used, the ngx_quic_replace_retired_client_id() function
is supposed to find all users and unref the ID, thus ngx_quic_unref_client_id()
should not be called after it.
Diffstat (limited to 'src')
-rw-r--r-- | src/event/quic/ngx_event_quic_connid.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/event/quic/ngx_event_quic_connid.c b/src/event/quic/ngx_event_quic_connid.c index 273b58c65..2ad65077a 100644 --- a/src/event/quic/ngx_event_quic_connid.c +++ b/src/event/quic/ngx_event_quic_connid.c @@ -183,9 +183,10 @@ retire: if (ngx_quic_replace_retired_client_id(c, cid) != NGX_OK) { return NGX_ERROR; } - } - ngx_quic_unref_client_id(c, cid); + } else { + ngx_quic_unref_client_id(c, cid); + } } done: @@ -534,7 +535,9 @@ ngx_quic_unref_client_id(ngx_connection_t *c, ngx_quic_client_id_t *cid) { ngx_quic_connection_t *qc; - cid->refcnt--; + if (cid->refcnt) { + cid->refcnt--; + } /* else: unused client id */ if (cid->refcnt) { return; |