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 125d298..93e68d5 100644
--- a/src/mux_quic.c
+++ b/src/mux_quic.c
@@ -1950,6 +1950,23 @@
TRACE_LEAVE(QMUX_EV_QCC_END, qcc->conn);
}
+/* Conduct operations which should be made for <qcc> connection after
+ * input/output. Most notably, closed streams are purged which may leave the
+ * connection has ready to be released.
+ *
+ * Returns 1 if <qcc> 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 @@
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 @@
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 @@
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;