BUG/MINOR: quic: fix FIN stream signaling

If the last frame is not entirely copied and must be buffered, FIN
must not be signaled to the upper layer.

This might fix a rare bug which could cause the request channel to be
closed too early leading to an incomplete request.
This commit is contained in:
Amaury Denoyelle 2022-02-15 10:57:16 +01:00
parent ab9cec7ce1
commit 6a2c2f4910

View File

@ -2054,6 +2054,7 @@ static int qc_handle_bidi_strm_frm(struct quic_rx_packet *pkt,
struct qcs *strm;
struct eb64_node *strm_node;
struct quic_rx_strm_frm *frm;
char fin = 0;
strm_node = qcc_get_qcs(qc->qcc, strm_frm->id);
if (!strm_node) {
@ -2092,7 +2093,9 @@ static int qc_handle_bidi_strm_frm(struct quic_rx_packet *pkt,
}
total += qc_treat_rx_strm_frms(strm);
if (total && qc->qcc->app_ops->decode_qcs(strm, strm_frm->fin, qc->qcc->ctx) < 0) {
/* FIN is set only if all data were copied. */
fin = strm_frm->fin && !strm_frm->len;
if (total && qc->qcc->app_ops->decode_qcs(strm, fin, qc->qcc->ctx) < 0) {
TRACE_PROTO("Decoding error", QUIC_EV_CONN_PSTRM, qc);
return 0;
}