From: Amaury Denoyelle Date: Tue, 24 Jan 2023 17:19:47 +0000 (+0100) Subject: MINOR: mux-quic: define qc_process() X-Git-Tag: v2.8-dev5~163 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=14dbb848afea4b1ea2c015f09e2dd870ec257d48;p=thirdparty%2Fhaproxy.git MINOR: mux-quic: define qc_process() Define a new function qc_process(). This function will regroup several internal operation which should be called both on I/O tasklet and wake() callback. For the moment, only streams purge is conducted there. This patch is useful to support haproxy soft stop. This should be backported up to 2.7. --- diff --git a/src/mux_quic.c b/src/mux_quic.c index 125d2984e5..93e68d5b95 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -1950,6 +1950,23 @@ static void qc_shutdown(struct qcc *qcc) TRACE_LEAVE(QMUX_EV_QCC_END, qcc->conn); } +/* Conduct operations which should be made for connection after + * input/output. Most notably, closed streams are purged which may leave the + * connection has ready to be released. + * + * Returns 1 if must be released else 0. + */ + +static int qc_process(struct qcc *qcc) +{ + qc_purge_streams(qcc); + + if (qcc_is_dead(qcc)) + return 1; + + return 0; +} + /* release function. This one should be called to free all resources allocated * to the mux. */ @@ -2021,18 +2038,12 @@ struct task *qc_io_cb(struct task *t, void *ctx, unsigned int status) qc_send(qcc); - if (qc_purge_streams(qcc)) { - if (qcc_is_dead(qcc)) { - TRACE_STATE("releasing dead connection", QMUX_EV_QCC_WAKE, qcc->conn); - goto release; - } - } - qc_recv(qcc); - /* TODO check if qcc proxy is disabled. If yes, use graceful shutdown - * to close the connection. - */ + if (qc_process(qcc)) { + TRACE_STATE("releasing dead connection", QMUX_EV_QCC_WAKE, qcc->conn); + goto release; + } qcc_refresh_timeout(qcc); @@ -2451,10 +2462,12 @@ static int qc_wake(struct connection *conn) qc_send(qcc); - qc_wake_some_streams(qcc); - - if (qcc_is_dead(qcc)) + if (qc_process(qcc)) { + TRACE_STATE("releasing dead connection", QMUX_EV_QCC_WAKE, qcc->conn); goto release; + } + + qc_wake_some_streams(qcc); qcc_refresh_timeout(qcc); @@ -2462,7 +2475,6 @@ static int qc_wake(struct connection *conn) return 0; release: - TRACE_STATE("releasing dead connection", QMUX_EV_QCC_WAKE, qcc->conn); qc_release(qcc); TRACE_LEAVE(QMUX_EV_QCC_WAKE); return 1;