mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 22:31:28 +02:00
MINOR: quic: Handle the cases of overlapping STREAM frames
This is the same treatment for bidi and uni STREAM frames. This is a duplication code which should me remove building a function for both these types of streams.
This commit is contained in:
parent
01cfec74f5
commit
10250b2e93
@ -2046,7 +2046,7 @@ static int qc_handle_bidi_strm_frm(struct quic_rx_packet *pkt,
|
|||||||
{
|
{
|
||||||
int total;
|
int total;
|
||||||
struct qcs *strm;
|
struct qcs *strm;
|
||||||
struct eb64_node *strm_node, *frm_node;
|
struct eb64_node *strm_node;
|
||||||
struct quic_rx_strm_frm *frm;
|
struct quic_rx_strm_frm *frm;
|
||||||
|
|
||||||
strm_node = qcc_get_qcs(qc->qcc, strm_frm->id);
|
strm_node = qcc_get_qcs(qc->qcc, strm_frm->id);
|
||||||
@ -2056,14 +2056,22 @@ static int qc_handle_bidi_strm_frm(struct quic_rx_packet *pkt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
strm = eb64_entry(&strm_node->node, struct qcs, by_id);
|
strm = eb64_entry(&strm_node->node, struct qcs, by_id);
|
||||||
frm_node = eb64_lookup(&strm->rx.frms, strm_frm->offset.key);
|
if (strm_frm->offset.key < strm->rx.offset) {
|
||||||
/* FIXME: handle the case where this frame overlap others */
|
size_t diff;
|
||||||
if (frm_node) {
|
|
||||||
TRACE_PROTO("Already existing stream data",
|
if (strm_frm->offset.key + strm_frm->len <= strm->rx.offset) {
|
||||||
|
TRACE_PROTO("Already received STREAM data",
|
||||||
QUIC_EV_CONN_PSTRM, qc);
|
QUIC_EV_CONN_PSTRM, qc);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TRACE_PROTO("Partially already received STREAM data", QUIC_EV_CONN_PSTRM, qc);
|
||||||
|
diff = strm->rx.offset - strm_frm->offset.key;
|
||||||
|
strm_frm->offset.key = strm->rx.offset;
|
||||||
|
strm_frm->len -= diff;
|
||||||
|
strm_frm->data += diff;
|
||||||
|
}
|
||||||
|
|
||||||
total = 0;
|
total = 0;
|
||||||
if (strm_frm->offset.key == strm->rx.offset) {
|
if (strm_frm->offset.key == strm->rx.offset) {
|
||||||
int ret;
|
int ret;
|
||||||
@ -2112,7 +2120,7 @@ static int qc_handle_uni_strm_frm(struct quic_rx_packet *pkt,
|
|||||||
struct quic_conn *qc)
|
struct quic_conn *qc)
|
||||||
{
|
{
|
||||||
struct qcs *strm;
|
struct qcs *strm;
|
||||||
struct eb64_node *strm_node, *frm_node;
|
struct eb64_node *strm_node;
|
||||||
struct quic_rx_strm_frm *frm;
|
struct quic_rx_strm_frm *frm;
|
||||||
size_t strm_frm_len;
|
size_t strm_frm_len;
|
||||||
|
|
||||||
@ -2123,14 +2131,22 @@ static int qc_handle_uni_strm_frm(struct quic_rx_packet *pkt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
strm = eb64_entry(&strm_node->node, struct qcs, by_id);
|
strm = eb64_entry(&strm_node->node, struct qcs, by_id);
|
||||||
frm_node = eb64_lookup(&strm->rx.frms, strm_frm->offset.key);
|
if (strm_frm->offset.key < strm->rx.offset) {
|
||||||
/* FIXME: handle the case where this frame overlap others */
|
size_t diff;
|
||||||
if (frm_node) {
|
|
||||||
TRACE_PROTO("Already existing stream data",
|
if (strm_frm->offset.key + strm_frm->len <= strm->rx.offset) {
|
||||||
|
TRACE_PROTO("Already received STREAM data",
|
||||||
QUIC_EV_CONN_PSTRM, qc);
|
QUIC_EV_CONN_PSTRM, qc);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TRACE_PROTO("Partially already received STREAM data", QUIC_EV_CONN_PSTRM, qc);
|
||||||
|
diff = strm->rx.offset - strm_frm->offset.key;
|
||||||
|
strm_frm->offset.key = strm->rx.offset;
|
||||||
|
strm_frm->len -= diff;
|
||||||
|
strm_frm->data += diff;
|
||||||
|
}
|
||||||
|
|
||||||
strm_frm_len = strm_frm->len;
|
strm_frm_len = strm_frm->len;
|
||||||
if (strm_frm->offset.key == strm->rx.offset) {
|
if (strm_frm->offset.key == strm->rx.offset) {
|
||||||
int ret;
|
int ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user