]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-quic: remove uneeded code to check fin on TX
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 7 Dec 2021 15:50:14 +0000 (16:50 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 7 Dec 2021 16:11:22 +0000 (17:11 +0100)
Remove a wrong comparaison with the same buffer on both sides. In any
cases, the FIN is properly set by qcs_push_frame only when the payload
has been totally emptied.

src/mux_quic.c

index 2a28a5155e2c3baa4a5eeb983d59a2496148cb96..981235520ca85e4d8642ed00ca892ada284c64e1 100644 (file)
@@ -136,6 +136,7 @@ static int qcs_push_frame(struct qcs *qcs, struct buffer *payload, int fin, uint
                goto err;
 
        total = b_force_xfer(buf, payload, to_xfer);
+       /* FIN is positioned only when the buffer has been totally emptied. */
        fin = fin && !b_data(payload);
        frm->type = QUIC_FT_STREAM_8;
        if (fin)
@@ -177,16 +178,7 @@ static int qc_send(struct qcc *qcc)
                struct qcs *qcs = container_of(node, struct qcs, by_id);
                struct buffer *buf = &qcs->tx.buf;
                if (b_data(buf)) {
-                       char fin = 0;
-
-                       /* if FIN is activated, ensure the buffer to
-                        * send is the last
-                        */
-                       if (qcs->flags & QC_SF_FIN_STREAM) {
-                               BUG_ON(b_data(&qcs->tx.buf) < b_data(buf));
-                               fin = (b_data(&qcs->tx.buf) - b_data(buf) == 0);
-                       }
-
+                       char fin = qcs->flags & QC_SF_FIN_STREAM;
                        ret = qcs_push_frame(qcs, buf, fin, qcs->tx.offset);
                        if (ret < 0)
                                ABORT_NOW();