From: Amaury Denoyelle Date: Tue, 7 Dec 2021 15:50:14 +0000 (+0100) Subject: MINOR: mux-quic: remove uneeded code to check fin on TX X-Git-Tag: v2.6-dev1~306 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fecfa0d82281910cf158d3d310943e974f9ff9d1;p=thirdparty%2Fhaproxy.git MINOR: mux-quic: remove uneeded code to check fin on TX 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. --- diff --git a/src/mux_quic.c b/src/mux_quic.c index 2a28a5155e..981235520c 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -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();