diff --git a/src/mux_quic.c b/src/mux_quic.c index 2a28a5155..981235520 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();