From 3e3a6214474b99bed784f9019360441afb3ca1e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Mon, 25 Apr 2022 10:17:00 +0200 Subject: [PATCH] MINOR: quic: old data distinction for qc_send_app_pkt() Modify qc_send_app_pkt() to distinguish the case where it sends new data against the case where it sends old data during probing retransmissions. We add boolean parameter to this function to do so. The mux never directly send old data when probing retransmissions are needed by the connection. --- include/haproxy/xprt_quic.h | 2 +- src/mux_quic.c | 2 +- src/xprt_quic.c | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/haproxy/xprt_quic.h b/include/haproxy/xprt_quic.h index 1a2a3ce4b..8fb24e370 100644 --- a/include/haproxy/xprt_quic.h +++ b/include/haproxy/xprt_quic.h @@ -1246,7 +1246,7 @@ struct task *quic_lstnr_dghdlr(struct task *t, void *ctx, unsigned int state); int quic_lstnr_dgram_dispatch(unsigned char *buf, size_t len, void *owner, struct sockaddr_storage *saddr, struct quic_dgram *new_dgram, struct list *dgrams); -int qc_send_app_pkts(struct quic_conn *qc, struct list *frms); +int qc_send_app_pkts(struct quic_conn *qc, int old_data, struct list *frms); void qc_notify_close(struct quic_conn *qc); diff --git a/src/mux_quic.c b/src/mux_quic.c index edf2be845..2e5ebdc9f 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -799,7 +799,7 @@ static int qc_send_frames(struct qcc *qcc, struct list *frms) } if (!LIST_ISEMPTY(frms)) - qc_send_app_pkts(qcc->conn->handle.qc, frms); + qc_send_app_pkts(qcc->conn->handle.qc, 0, frms); /* If there is frames left, check if the transport layer has send some * data or is blocked. diff --git a/src/xprt_quic.c b/src/xprt_quic.c index 615c4ff44..d688f20b3 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -3763,7 +3763,7 @@ static int qc_qel_may_rm_hp(struct quic_conn *qc, struct quic_enc_level *qel) } /* Sends application level packets from QUIC connection */ -int qc_send_app_pkts(struct quic_conn *qc, struct list *frms) +int qc_send_app_pkts(struct quic_conn *qc, int old_data, struct list *frms) { int ret; struct qring *qr; @@ -3773,6 +3773,8 @@ int qc_send_app_pkts(struct quic_conn *qc, struct list *frms) /* Never happens */ return 1; + if (old_data) + qc->flags |= QUIC_FL_CONN_RETRANS_OLD_DATA; ret = qc_prep_app_pkts(qc, qr, frms); if (ret == -1) goto err; @@ -3783,10 +3785,12 @@ int qc_send_app_pkts(struct quic_conn *qc, struct list *frms) goto err; out: + qc->flags &= ~QUIC_FL_CONN_RETRANS_OLD_DATA; MT_LIST_APPEND(qc->tx.qring_list, &qr->mt_list); return 1; err: + qc->flags &= ~QUIC_FL_CONN_RETRANS_OLD_DATA; MT_LIST_APPEND(qc->tx.qring_list, &qr->mt_list); TRACE_DEVEL("leaving in error", QUIC_EV_CONN_IO_CB, qc); return 0; @@ -3926,7 +3930,7 @@ static struct task *quic_conn_app_io_cb(struct task *t, void *context, unsigned !(qc->flags & QUIC_FL_CONN_IMMEDIATE_CLOSE)) goto out; - if (!qc_send_app_pkts(qc, &qel->pktns->tx.frms)) + if (!qc_send_app_pkts(qc, 0, &qel->pktns->tx.frms)) goto err; out: