]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: quic: implement refcount for quic_conn
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 23 Dec 2021 09:02:50 +0000 (10:02 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 23 Dec 2021 15:06:07 +0000 (16:06 +0100)
commit76f47caacc8989aec01ccf16a676cfa863f4c966
treef28185acb56ae40f20613c6b6d9deac5d63aae5a
parent0a29e138358afb503967edf2f8508912ee58ccd7
MEDIUM: quic: implement refcount for quic_conn

Implement a refcount on quic_conn instance. By default, the refcount is
0. Two functions are implemented to manipulate it.
* qc_conn_take() which increments the refcount
* qc_conn_drop() which decrements it. If the refcount is 0 *BEFORE*
  the substraction, the instance is freed.

The refcount is incremented on retrieve_qc_conn_from_cid() or when
allocating a new quic_conn in qc_lstnr_pkt_rcv(). It is substracted most
notably by the xprt.close operation and at the end of
qc_lstnr_pkt_rcv(). The increments/decrements should be conducted under
the CID lock to guarantee thread-safety.
include/haproxy/xprt_quic-t.h
include/haproxy/xprt_quic.h
src/xprt_quic.c