mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
MINOR: Add function for TX packets reference counting
Add two functions to encrement or decrement a referenc counter attached to TX packet structure (struct quic_tx_packet). The packet are freed when their counters reach the null value.
This commit is contained in:
parent
c8d3f873e8
commit
b095252a23
@ -482,6 +482,8 @@ struct quic_tx_packet {
|
||||
struct quic_pktns *pktns;
|
||||
/* Flags. */
|
||||
unsigned int flags;
|
||||
/* Reference counter */
|
||||
int refcnt;
|
||||
/* Next packet in the same datagram */
|
||||
struct quic_tx_packet *next;
|
||||
};
|
||||
|
@ -1064,6 +1064,19 @@ static inline void free_quic_rx_packet(struct quic_rx_packet *pkt)
|
||||
quic_rx_packet_refdec(pkt);
|
||||
}
|
||||
|
||||
/* Increment the reference counter of <pkt> */
|
||||
static inline void quic_tx_packet_refinc(struct quic_tx_packet *pkt)
|
||||
{
|
||||
HA_ATOMIC_ADD(&pkt->refcnt, 1);
|
||||
}
|
||||
|
||||
/* Decrement the reference counter of <pkt> */
|
||||
static inline void quic_tx_packet_refdec(struct quic_tx_packet *pkt)
|
||||
{
|
||||
if (!HA_ATOMIC_SUB_FETCH(&pkt->refcnt, 1))
|
||||
pool_free(pool_head_quic_tx_packet, pkt);
|
||||
}
|
||||
|
||||
ssize_t quic_lstnr_dgram_read(char *buf, size_t len, void *owner,
|
||||
struct sockaddr_storage *saddr);
|
||||
ssize_t quic_srv_dgram_read(char *buf, size_t len, void *owner,
|
||||
|
Loading…
x
Reference in New Issue
Block a user