mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-16 02:26:54 +00:00
MINOR: mux-quic: reorganize qcs free
Regroup some cleaning operations inside a new function qcs_free. This can be used for all streams, both through qcs_destroy and with uni-directional streams.
This commit is contained in:
parent
50742294f5
commit
dccbd733f0
@ -12,7 +12,7 @@
|
|||||||
#include <haproxy/xprt_quic-t.h>
|
#include <haproxy/xprt_quic-t.h>
|
||||||
|
|
||||||
struct qcs *qcs_new(struct qcc *qcc, uint64_t id, enum qcs_type type);
|
struct qcs *qcs_new(struct qcc *qcc, uint64_t id, enum qcs_type type);
|
||||||
void uni_qcs_free(struct qcs *qcs);
|
void qcs_free(struct qcs *qcs);
|
||||||
|
|
||||||
struct buffer *qc_get_buf(struct qcs *qcs, struct buffer *bptr);
|
struct buffer *qc_get_buf(struct qcs *qcs, struct buffer *bptr);
|
||||||
|
|
||||||
|
2
src/h3.c
2
src/h3.c
@ -840,7 +840,7 @@ static int h3_uqs_init(struct h3_uqs *h3_uqs, struct h3 *h3,
|
|||||||
static inline void h3_uqs_release(struct h3_uqs *h3_uqs)
|
static inline void h3_uqs_release(struct h3_uqs *h3_uqs)
|
||||||
{
|
{
|
||||||
if (h3_uqs->qcs)
|
if (h3_uqs->qcs)
|
||||||
uni_qcs_free(h3_uqs->qcs);
|
qcs_free(h3_uqs->qcs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void h3_uqs_release_all(struct h3 *h3)
|
static inline void h3_uqs_release_all(struct h3 *h3)
|
||||||
|
@ -137,11 +137,19 @@ struct qcs *qcs_new(struct qcc *qcc, uint64_t id, enum qcs_type type)
|
|||||||
return qcs;
|
return qcs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free a qcs. This function must only be used for unidirectional streams.
|
/* Free a qcs. This function must only be done to remove a stream on allocation
|
||||||
* Bidirectional streams are released by the upper layer through qc_detach().
|
* error or connection shutdown. Else use qcs_destroy which handle all the
|
||||||
|
* QUIC connection mechanism.
|
||||||
*/
|
*/
|
||||||
void uni_qcs_free(struct qcs *qcs)
|
void qcs_free(struct qcs *qcs)
|
||||||
{
|
{
|
||||||
|
b_free(&qcs->rx.buf);
|
||||||
|
b_free(&qcs->tx.buf);
|
||||||
|
b_free(&qcs->tx.xprt_buf);
|
||||||
|
|
||||||
|
BUG_ON(!qcs->qcc->strms[qcs_id_type(qcs->by_id.key)].nb_streams);
|
||||||
|
--qcs->qcc->strms[qcs_id_type(qcs->by_id.key)].nb_streams;
|
||||||
|
|
||||||
eb64_delete(&qcs->by_id);
|
eb64_delete(&qcs->by_id);
|
||||||
pool_free(pool_head_qcs, qcs);
|
pool_free(pool_head_qcs, qcs);
|
||||||
}
|
}
|
||||||
@ -431,15 +439,7 @@ static void qcs_destroy(struct qcs *qcs)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eb64_delete(&qcs->by_id);
|
qcs_free(qcs);
|
||||||
|
|
||||||
b_free(&qcs->rx.buf);
|
|
||||||
b_free(&qcs->tx.buf);
|
|
||||||
b_free(&qcs->tx.xprt_buf);
|
|
||||||
|
|
||||||
--qcs->qcc->strms[qcs_id_type(qcs->by_id.key)].nb_streams;
|
|
||||||
|
|
||||||
pool_free(pool_head_qcs, qcs);
|
|
||||||
|
|
||||||
TRACE_LEAVE(QMUX_EV_QCS_END, conn);
|
TRACE_LEAVE(QMUX_EV_QCS_END, conn);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user