]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: quic: Allow the quic_conn memory to be asap released.
authorFrédéric Lécaille <flecaille@haproxy.com>
Mon, 7 Aug 2023 15:45:23 +0000 (17:45 +0200)
committerFrédéric Lécaille <flecaille@haproxy.com>
Tue, 8 Aug 2023 12:59:17 +0000 (14:59 +0200)
commit9f7cfb0a56352188854bdaef9617ca836c2a30c9
tree75d36ed5fe709cb9ca30cfbd224bb954921fc975
parent276697438d50456f92487c990f20c4d726dfdb96
MEDIUM: quic: Allow the quic_conn memory to be asap released.

When the connection enters the "connection closing" state after having sent
a datagram with CONNECTION_CLOSE frames inside its packets, a lot of memory
may be freed from quic_conn objects (QUIC connection). This is done allocating
a reduced sized object which keeps enough information to handle the remaining
incoming packets for the connection in "connection closing" state, and to
continue to send again the previous datagram with CONNECTION_CLOSE frames inside
which has already been sent.

Define a new quic_cc_conn struct which represents the connection object after
entering the "connection close" state and after having release the quic_conn
connection object.

Define <pool_head_quic_cc_conn> new pool for these quic_cc_conn struct objects.

Define QUIC_CONN_COMMON structure which is shared between quic_conn struct object
(the connection before entering "connection close" state), and new quic_cc_conn
struct object (the connection after entering "connection close"). So, all the
members inside QUIC_CONN_COMMON may be indifferently dereferenced from a
quic_conn struct or a quic_cc_conn struct pointer.

Implement qc_new_cc_conn() function to allocate such connections in
"connection close" state. This function is responsible of copying the
required information from the original connection (quic_conn) to the remaining
connection (quic_cc_conn). Among others initialization, it redefined the
QUIC packet handler task to quic_cc_conn_io_cb() and the idle timer task
to qc_cc_idle_timer_task(). quic_cc_conn_io_cb() drains the received and
resend the datagram which CONNECTION_CLOSE frame which has already been sent
when entering "connection close" state. qc_cc_idle_timer_task() only releases
the remaining quic_cc_conn struct object.

Modify quic_conn_release() to allocate quic_cc_conn struct objects from the
original connection passed as argument. It does nothing if this original
connection is not in closing state, or if the idle timer has already expired.

Implement quic_release_cc_conn() to release a "connection close" connection.
It is called when its timer expires or if an error occured when sending
a packet from this connection when the peer is no more reachable.
include/haproxy/quic_conn-t.h
include/haproxy/quic_conn.h
src/quic_conn.c