]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-quic: set EOS on rcv_buf
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 14 Feb 2022 16:11:32 +0000 (17:11 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 15 Feb 2022 16:10:51 +0000 (17:10 +0100)
Flags EOI/EOS must be set on conn-stream when transfering the last data
of a stream in rcv_buf. This is activated if qcs HTX buffer has the EOM
flag and has been fully transfered.

src/mux_quic.c

index 3424a2276368f8f93d196a979e0815f223d62ccf..2ed269e3cb39370c4a8a5fb3e06e3996bdd7824d 100644 (file)
@@ -558,6 +558,7 @@ static size_t qc_rcv_buf(struct conn_stream *cs, struct buffer *buf,
        struct htx *qcs_htx = NULL;
        struct htx *cs_htx = NULL;
        size_t ret = 0;
+       char fin = 0;
 
        fprintf(stderr, "%s\n", __func__);
 
@@ -582,8 +583,10 @@ static size_t qc_rcv_buf(struct conn_stream *cs, struct buffer *buf,
        BUG_ON(qcs_htx->flags & HTX_FL_PARSING_ERROR);
 
        /* Copy EOM from src to dst buffer if all data copied. */
-       if (htx_is_empty(qcs_htx))
-               cs_htx->flags |= (qcs_htx->flags & HTX_FL_EOM);
+       if (htx_is_empty(qcs_htx) && (qcs_htx->flags & HTX_FL_EOM)) {
+               cs_htx->flags |= HTX_FL_EOM;
+               fin = 1;
+       }
 
        cs_htx->extra = qcs_htx->extra ? (qcs_htx->data + qcs_htx->extra) : 0;
        htx_to_buf(cs_htx, buf);
@@ -599,7 +602,8 @@ static size_t qc_rcv_buf(struct conn_stream *cs, struct buffer *buf,
                if (cs->flags & CS_FL_ERR_PENDING)
                        cs->flags |= CS_FL_ERROR;
 
-               /* TODO put CS_FL_EOI/EOS on fin */
+               if (fin)
+                       cs->flags |= (CS_FL_EOI|CS_FL_EOS);
 
                if (b_size(&qcs->rx.app_buf)) {
                        b_free(&qcs->rx.app_buf);