From e9c4cc13fc4d6d1733ffcefe9c8f12c49f9bc713 Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Fri, 4 Mar 2022 15:29:53 +0100 Subject: [PATCH] MINOR: mux-quic: retry send opportunistically for remaining frames This commit should fix the possible transfer interruption caused by the previous commit. The MUX always retry to send frames if there is remaining data after a send call on the transport layer. This is useful if the transport layer is not blocked on the sending path. In the future, the transport layer should retry by itself the send operation if no blocking condition exists. The MUX layer will always subscribe to retry later if remaining frames are reported which indicate a blocking on the transport layer. --- src/mux_quic.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/mux_quic.c b/src/mux_quic.c index 24ba82933..cf1d72e9c 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -388,13 +388,24 @@ static int qcs_push_frame(struct qcs *qcs, struct buffer *payload, int fin, uint */ static int qc_send_frames(struct qcc *qcc, struct list *frms) { + void *first_frm = NULL; + + retry_send: if (!LIST_ISEMPTY(frms)) qc_send_app_pkts(qcc->conn->qc, frms); - /* TODO Currently, the transport layer is not complete. It might not - * try to send all frames even if the Tx buffer is free. In this case - * it is necessary to retry immediately instead of subscribing. + /* if the frame list is not empty, retry immediatly to send. Remember + * the first frame in the list : if the pointer did not advance, it + * means the transport layer is blocked. + * + * TODO implement immediate retry on transport layer. This way on mux + * always subscribe if the list is not empty. */ + if (!LIST_ISEMPTY(frms) && first_frm != frms->n) { + first_frm = frms->n; + goto retry_send; + } + if (!LIST_ISEMPTY(frms)) { fprintf(stderr, "%s: remaining frames to send\n", __func__); qcc->conn->xprt->subscribe(qcc->conn, qcc->conn->xprt_ctx,