# HG changeset patch # User Vladimir Homutov # Date 1634125713 -10800 # Node ID e2ec952dc295d199aec56f96c19a06557f99d249 # Parent 4b2d259bdadd24e4a3f88fd259b91aeba99c132c 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. diff --git a/src/event/quic/ngx_event_quic_connid.c b/src/event/quic/ngx_event_quic_connid.c --- 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; } + + } else { + ngx_quic_unref_client_id(c, cid); } - - ngx_quic_unref_client_id(c, cid); } done: @@ -534,7 +535,9 @@ ngx_quic_unref_client_id(ngx_connection_ { ngx_quic_connection_t *qc; - cid->refcnt--; + if (cid->refcnt) { + cid->refcnt--; + } /* else: unused client id */ if (cid->refcnt) { return;