]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: mux-quic: remove loop on sending frames
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 4 Aug 2022 08:11:12 +0000 (10:11 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 9 Aug 2022 13:41:07 +0000 (15:41 +0200)
qc_send_app_pkts() has now a while loop implemented which allows to send
all possible frames even if the send buffer is full between packet
prepare and send. This is present since commit :
  dc07751ed7ebad10f49081d28a9a5ae785f53d76
  MINOR: quic: Send packets as much as possible from qc_send_app_pkts()

This means we can remove code from the MUX which implement this at the
upper layer. This is useful to simplify qc_send_frames() function.

As mentionned commit is subject to backport, this commit should be
backported as well to 2.6.

src/mux_quic.c

index dd9e9f4a4e7ccfdac446438927025ec06b5e5571..96a2b6b4505d8a6b0bef0672ec33b07e13d2f530 100644 (file)
@@ -1349,22 +1349,6 @@ void qcc_streams_sent_done(struct qcs *qcs, uint64_t data, uint64_t offset)
  */
 static int qc_send_frames(struct qcc *qcc, struct list *frms)
 {
-       /* TODO implement an opportunistic retry mechanism. This is needed
-        * because qc_send_app_pkts is not completed. It will only prepare data
-        * up to its Tx buffer. The frames left are not send even if the Tx
-        * buffer is emptied by the sendto call.
-        *
-        * To overcome this, we call repeatedly qc_send_app_pkts until we
-        * detect that the transport layer has send nothing. This could happen
-        * on congestion or sendto syscall error.
-        *
-        * When qc_send_app_pkts is improved to handle retry by itself, we can
-        * remove the looping from the MUX.
-        */
-       struct quic_frame *first_frm;
-       uint64_t first_offset = 0;
-       char first_stream_frame_type;
-
        TRACE_ENTER(QMUX_EV_QCC_SEND, qcc->conn);
 
        if (LIST_ISEMPTY(frms)) {
@@ -1374,34 +1358,7 @@ static int qc_send_frames(struct qcc *qcc, struct list *frms)
 
        LIST_INIT(&qcc->send_retry_list);
 
- retry_send:
-       first_frm = LIST_ELEM(frms->n, struct quic_frame *, list);
-       if ((first_frm->type & QUIC_FT_STREAM_8) == QUIC_FT_STREAM_8) {
-               first_offset = first_frm->stream.offset.key;
-               first_stream_frame_type = 1;
-       }
-       else {
-               first_stream_frame_type = 0;
-       }
-
-       if (!LIST_ISEMPTY(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.
-        */
-       if (!LIST_ISEMPTY(frms)) {
-               if (first_frm != LIST_ELEM(frms->n, struct quic_frame *, list))
-                       goto retry_send;
-
-               /* If the first frame is STREAM, check if its offset has
-                * changed.
-                */
-               if (first_stream_frame_type &&
-                   first_offset != LIST_ELEM(frms->n, struct quic_frame *, list)->stream.offset.key) {
-                       goto retry_send;
-               }
-       }
+       qc_send_app_pkts(qcc->conn->handle.qc, 0, frms);
 
        /* If there is frames left at this stage, transport layer is blocked.
         * Subscribe on it to retry later.