MINOR: quic: fix handling of out-of-order received STREAM frames
The recent changes was not complete.
d1c76f24fdf1cfb85e574cb1ef0c773b74bee32a
MINOR: quic: do not modify offset node if quic_rx_strm_frm in tree
The frame length and data pointer should incremented after the data
copy. A BUG_ON statement has been added to detect an incorrect decrement
operaiton.
diff --git a/src/xprt_quic.c b/src/xprt_quic.c
index b052509..cefa4c6 100644
--- a/src/xprt_quic.c
+++ b/src/xprt_quic.c
@@ -2011,12 +2011,15 @@
ret = qc_rx_strm_frm_cpy(&qcs->rx.buf, frm);
qcs->rx.offset += ret;
total += ret;
- if (frm->len) {
- /* If there is remaining data in this frame
- * this is because the destination buffer is full.
+
+ BUG_ON(frm->len < ret);
+ if (frm->len - ret > 0) {
+ /* Remove the frame from the tree before updating the
+ * offset field.
*/
eb64_delete(&frm->offset_node);
frm->offset_node.key += ret;
+ frm->data += ret;
frm->len -= ret;
eb64_insert(&qcs->rx.frms, &frm->offset_node);
break;