mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-01-17 23:01:06 +01:00
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.