]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-quic: retry send opportunistically for remaining frames
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 4 Mar 2022 14:29:53 +0000 (15:29 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 4 Mar 2022 16:00:12 +0000 (17:00 +0100)
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

index 24ba82933aaa8f959c3bdbb28c1d55ed95ee9094..cf1d72e9c461551032d4c9058b9a607cb0d05cea 100644 (file)
@@ -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,