]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: notify on send ready
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 28 Feb 2023 14:11:26 +0000 (15:11 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 1 Mar 2023 13:32:37 +0000 (14:32 +0100)
This patch completes the previous one with poller subscribe of quic-conn
owned socket on sendto() error. This ensures that mux-quic is notified
if waiting on sending when a transient sendto() error is cleared. As
such, qc_notify_send() is called directly inside socket I/O callback.

qc_notify_send() internal condition have been thus completed. This will
prevent to notify upper layer until all sending condition are fulfilled:
room in congestion window and no transient error on socket FD.

This should be backported up to 2.7.

src/mux_quic.c
src/quic_conn.c
src/quic_sock.c

index a1cb6671703c3b28a2b2dd035875af0f83263416..cce191bd748a0f50b721e38a9190185a483b3855 100644 (file)
@@ -1603,8 +1603,13 @@ static int qc_send_frames(struct qcc *qcc, struct list *frms)
                goto err;
        }
 
-       if (!qc_send_mux(qcc->conn->handle.qc, frms))
+       if (!qc_send_mux(qcc->conn->handle.qc, frms)) {
+               /* TODO should subscribe only for a transient send error */
+               TRACE_DEVEL("error on send, subscribing", QMUX_EV_QCC_SEND, qcc->conn);
+               qcc->conn->xprt->subscribe(qcc->conn, qcc->conn->xprt_ctx,
+                                          SUB_RETRY_SEND, &qcc->wait_event);
                goto err;
+       }
 
        /* If there is frames left at this stage, transport layer is blocked.
         * Subscribe on it to retry later.
index 1021bb130b26591761c2d84a1da18f710aa41f64..4639e67a0ae4d6abf6c2f769455aafdc0ec2171f 100644 (file)
@@ -7809,7 +7809,8 @@ void qc_notify_close(struct quic_conn *qc)
 int qc_notify_send(struct quic_conn *qc)
 {
        if (qc->subs && qc->subs->events & SUB_RETRY_SEND) {
-               if (quic_path_prep_data(qc->path)) {
+               if (quic_path_prep_data(qc->path) &&
+                   (!qc_test_fd(qc) || !fd_send_active(qc->fd))) {
                        tasklet_wakeup(qc->subs->tasklet);
                        qc->subs->events &= ~SUB_RETRY_SEND;
                        if (!qc->subs->events)
index 8c99a76a68dfba76e390cade6317cc53d0919ddc..fa2eb3d822c679f2a9c40a45ecf378b7f4071f8b 100644 (file)
@@ -496,6 +496,7 @@ static void quic_conn_sock_fd_iocb(int fd)
                TRACE_DEVEL("send ready", QUIC_EV_CONN_RCV, qc);
                fd_stop_send(fd);
                tasklet_wakeup_after(NULL, qc->wait_event.tasklet);
+               qc_notify_send(qc);
        }
 
        if (fd_recv_ready(fd)) {