mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-21 03:00:35 +00:00
CLEANUP: mux-quic: move qc_release()
This change is purely cosmetic. qc_release() function is moved just before qc_io_cb(). It's cleaner as it brings it closer where it is used. More importantly, this will be required to be able to use it in qc_send() function.
This commit is contained in:
parent
240b1b108b
commit
c49d5d1a4b
136
src/mux_quic.c
136
src/mux_quic.c
@ -1014,74 +1014,6 @@ static inline int qcc_may_expire(struct qcc *qcc)
|
|||||||
return !qcc->nb_sc;
|
return !qcc->nb_sc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* release function. This one should be called to free all resources allocated
|
|
||||||
* to the mux.
|
|
||||||
*/
|
|
||||||
static void qc_release(struct qcc *qcc)
|
|
||||||
{
|
|
||||||
struct connection *conn = qcc->conn;
|
|
||||||
struct eb64_node *node;
|
|
||||||
|
|
||||||
TRACE_ENTER(QMUX_EV_QCC_END);
|
|
||||||
|
|
||||||
if (qcc->app_ops && qcc->app_ops->release) {
|
|
||||||
/* Application protocol with dedicated connection closing
|
|
||||||
* procedure.
|
|
||||||
*/
|
|
||||||
qcc->app_ops->release(qcc->ctx);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
qcc_emit_cc_app(qcc, QC_ERR_NO_ERROR, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (qcc->task) {
|
|
||||||
task_destroy(qcc->task);
|
|
||||||
qcc->task = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (qcc->wait_event.tasklet)
|
|
||||||
tasklet_free(qcc->wait_event.tasklet);
|
|
||||||
if (conn && qcc->wait_event.events) {
|
|
||||||
conn->xprt->unsubscribe(conn, conn->xprt_ctx,
|
|
||||||
qcc->wait_event.events,
|
|
||||||
&qcc->wait_event);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* liberate remaining qcs instances */
|
|
||||||
node = eb64_first(&qcc->streams_by_id);
|
|
||||||
while (node) {
|
|
||||||
struct qcs *qcs = eb64_entry(node, struct qcs, by_id);
|
|
||||||
node = eb64_next(node);
|
|
||||||
qcs_free(qcs);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (!LIST_ISEMPTY(&qcc->lfctl.frms)) {
|
|
||||||
struct quic_frame *frm = LIST_ELEM(qcc->lfctl.frms.n, struct quic_frame *, list);
|
|
||||||
LIST_DELETE(&frm->list);
|
|
||||||
pool_free(pool_head_quic_frame, frm);
|
|
||||||
}
|
|
||||||
|
|
||||||
pool_free(pool_head_qcc, qcc);
|
|
||||||
|
|
||||||
if (conn) {
|
|
||||||
LIST_DEL_INIT(&conn->stopping_list);
|
|
||||||
|
|
||||||
conn->handle.qc->conn = NULL;
|
|
||||||
conn->mux = NULL;
|
|
||||||
conn->ctx = NULL;
|
|
||||||
|
|
||||||
TRACE_DEVEL("freeing conn", QMUX_EV_QCC_END, conn);
|
|
||||||
|
|
||||||
conn_stop_tracking(conn);
|
|
||||||
conn_full_close(conn);
|
|
||||||
if (conn->destroy_cb)
|
|
||||||
conn->destroy_cb(conn);
|
|
||||||
conn_free(conn);
|
|
||||||
}
|
|
||||||
|
|
||||||
TRACE_LEAVE(QMUX_EV_QCC_END);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Transfer as much as possible data on <qcs> from <in> to <out>. This is done
|
/* Transfer as much as possible data on <qcs> from <in> to <out>. This is done
|
||||||
* in respect with available flow-control at stream and connection level.
|
* in respect with available flow-control at stream and connection level.
|
||||||
*
|
*
|
||||||
@ -1654,6 +1586,74 @@ static int qc_purge_streams(struct qcc *qcc)
|
|||||||
return release;
|
return release;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* release function. This one should be called to free all resources allocated
|
||||||
|
* to the mux.
|
||||||
|
*/
|
||||||
|
static void qc_release(struct qcc *qcc)
|
||||||
|
{
|
||||||
|
struct connection *conn = qcc->conn;
|
||||||
|
struct eb64_node *node;
|
||||||
|
|
||||||
|
TRACE_ENTER(QMUX_EV_QCC_END);
|
||||||
|
|
||||||
|
if (qcc->app_ops && qcc->app_ops->release) {
|
||||||
|
/* Application protocol with dedicated connection closing
|
||||||
|
* procedure.
|
||||||
|
*/
|
||||||
|
qcc->app_ops->release(qcc->ctx);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
qcc_emit_cc_app(qcc, QC_ERR_NO_ERROR, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (qcc->task) {
|
||||||
|
task_destroy(qcc->task);
|
||||||
|
qcc->task = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (qcc->wait_event.tasklet)
|
||||||
|
tasklet_free(qcc->wait_event.tasklet);
|
||||||
|
if (conn && qcc->wait_event.events) {
|
||||||
|
conn->xprt->unsubscribe(conn, conn->xprt_ctx,
|
||||||
|
qcc->wait_event.events,
|
||||||
|
&qcc->wait_event);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* liberate remaining qcs instances */
|
||||||
|
node = eb64_first(&qcc->streams_by_id);
|
||||||
|
while (node) {
|
||||||
|
struct qcs *qcs = eb64_entry(node, struct qcs, by_id);
|
||||||
|
node = eb64_next(node);
|
||||||
|
qcs_free(qcs);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!LIST_ISEMPTY(&qcc->lfctl.frms)) {
|
||||||
|
struct quic_frame *frm = LIST_ELEM(qcc->lfctl.frms.n, struct quic_frame *, list);
|
||||||
|
LIST_DELETE(&frm->list);
|
||||||
|
pool_free(pool_head_quic_frame, frm);
|
||||||
|
}
|
||||||
|
|
||||||
|
pool_free(pool_head_qcc, qcc);
|
||||||
|
|
||||||
|
if (conn) {
|
||||||
|
LIST_DEL_INIT(&conn->stopping_list);
|
||||||
|
|
||||||
|
conn->handle.qc->conn = NULL;
|
||||||
|
conn->mux = NULL;
|
||||||
|
conn->ctx = NULL;
|
||||||
|
|
||||||
|
TRACE_DEVEL("freeing conn", QMUX_EV_QCC_END, conn);
|
||||||
|
|
||||||
|
conn_stop_tracking(conn);
|
||||||
|
conn_full_close(conn);
|
||||||
|
if (conn->destroy_cb)
|
||||||
|
conn->destroy_cb(conn);
|
||||||
|
conn_free(conn);
|
||||||
|
}
|
||||||
|
|
||||||
|
TRACE_LEAVE(QMUX_EV_QCC_END);
|
||||||
|
}
|
||||||
|
|
||||||
static struct task *qc_io_cb(struct task *t, void *ctx, unsigned int status)
|
static struct task *qc_io_cb(struct task *t, void *ctx, unsigned int status)
|
||||||
{
|
{
|
||||||
struct qcc *qcc = ctx;
|
struct qcc *qcc = ctx;
|
||||||
|
Loading…
Reference in New Issue
Block a user