]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-quic: define STREAM frames list in qcc
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 16 Oct 2024 15:28:48 +0000 (17:28 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 21 Oct 2024 09:08:27 +0000 (11:08 +0200)
include/haproxy/mux_quic-t.h
src/mux_quic.c

index fcdd38b9bd14ee700461fc9cf270647ce967a8a2..381a492648607211baefdd60e2750e483c028788 100644 (file)
@@ -68,6 +68,7 @@ struct qcc {
        struct {
                struct quic_fctl fc; /* stream flow control applied on sending */
                uint64_t buf_in_flight; /* sum of currently allocated Tx buffer sizes */
+               struct list frms; /* prepared STREAM frames */
        } tx;
 
        uint64_t largest_bidi_r; /* largest remote bidi stream ID opened. */
index 302dc155b27db63acd6bd609d41da09908fa4912..32ca8377d917d9020a10aff5950216e8bead3882 100644 (file)
@@ -2243,7 +2243,6 @@ static int qcs_send(struct qcs *qcs, struct list *frms, uint64_t window_conn)
  */
 static int qcc_io_send(struct qcc *qcc)
 {
-       struct list frms = LIST_HEAD_INIT(frms);
        /* Temporary list for QCS on error. */
        struct list qcs_failed = LIST_HEAD_INIT(qcs_failed);
        struct qcs *qcs, *qcs_tmp, *first_qcs = NULL;
@@ -2337,7 +2336,7 @@ static int qcc_io_send(struct qcc *qcc)
 
                if (!qfctl_rblocked(&qcc->tx.fc) &&
                    !qfctl_rblocked(&qcs->tx.fc) && window_conn > total) {
-                       if ((ret = qcs_send(qcs, &frms, window_conn - total)) < 0) {
+                       if ((ret = qcs_send(qcs, &qcc->tx.frms, window_conn - total)) < 0) {
                                /* Temporarily remove QCS from send-list. */
                                LIST_DEL_INIT(&qcs->el_send);
                                LIST_APPEND(&qcs_failed, &qcs->el_send);
@@ -2361,7 +2360,7 @@ static int qcc_io_send(struct qcc *qcc)
        /* Retry sending until no frame to send, data rejected or connection
         * flow-control limit reached.
         */
-       while (qcc_send_frames(qcc, &frms) == 0 && !qfctl_rblocked(&qcc->tx.fc)) {
+       while (qcc_send_frames(qcc, &qcc->tx.frms) == 0 && !qfctl_rblocked(&qcc->tx.fc)) {
                window_conn = qfctl_rcap(&qcc->tx.fc);
                resent = 0;
 
@@ -2379,7 +2378,7 @@ static int qcc_io_send(struct qcc *qcc)
                        BUG_ON(resent > window_conn);
 
                        if (!qfctl_rblocked(&qcs->tx.fc) && window_conn > resent) {
-                               if ((ret = qcs_send(qcs, &frms, window_conn - resent)) < 0) {
+                               if ((ret = qcs_send(qcs, &qcc->tx.frms, window_conn - resent)) < 0) {
                                        LIST_DEL_INIT(&qcs->el_send);
                                        LIST_APPEND(&qcs_failed, &qcs->el_send);
                                        continue;
@@ -2393,10 +2392,10 @@ static int qcc_io_send(struct qcc *qcc)
 
  sent_done:
        /* Deallocate frames that the transport layer has rejected. */
-       if (!LIST_ISEMPTY(&frms)) {
+       if (!LIST_ISEMPTY(&qcc->tx.frms)) {
                struct quic_frame *frm, *frm2;
 
-               list_for_each_entry_safe(frm, frm2, &frms, list)
+               list_for_each_entry_safe(frm, frm2, &qcc->tx.frms, list)
                        qc_frm_free(qcc->conn->handle.qc, &frm);
        }
 
@@ -2717,6 +2716,10 @@ static void qcc_release(struct qcc *qcc)
                struct quic_frame *frm = LIST_ELEM(qcc->lfctl.frms.n, struct quic_frame *, list);
                qc_frm_free(qcc->conn->handle.qc, &frm);
        }
+       while (!LIST_ISEMPTY(&qcc->tx.frms)) {
+               struct quic_frame *frm = LIST_ELEM(qcc->tx.frms.n, struct quic_frame *, list);
+               qc_frm_free(qcc->conn->handle.qc, &frm);
+       }
 
        if (qcc->app_ops && qcc->app_ops->release)
                qcc->app_ops->release(qcc->ctx);
@@ -2831,6 +2834,7 @@ static void _qcc_init(struct qcc *qcc)
        qcc->app_ops = NULL;
        qcc->streams_by_id = EB_ROOT_UNIQUE;
        LIST_INIT(&qcc->lfctl.frms);
+       LIST_INIT(&qcc->tx.frms);
 }
 
 static int qmux_init(struct connection *conn, struct proxy *prx,