]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: use connection socket for emission
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 21 Nov 2022 13:48:57 +0000 (14:48 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 2 Dec 2022 13:45:43 +0000 (14:45 +0100)
If quic-conn has a dedicated socket, use it for sending over the
listener socket. This should improve performance by reducing contention
over the shared listener socket.

This change is part of quic-conn owned socket implementation.
It may be backported to 2.7 after a period of observation.

src/quic_sock.c

index bce8a1b1aedcd56bb59ce00f84c84a0357b88a3b..7de961392e0b944fada926ad9595ac1faad9cc6b 100644 (file)
@@ -495,9 +495,16 @@ int qc_snd_buf(struct quic_conn *qc, const struct buffer *buf, size_t sz,
        ssize_t ret;
 
        do {
-               ret = sendto(qc->li->rx.fd, b_peek(buf, b_head_ofs(buf)), sz,
-                            MSG_DONTWAIT | MSG_NOSIGNAL,
-                            (struct sockaddr *)&qc->peer_addr, get_addr_len(&qc->peer_addr));
+               if (qc_test_fd(qc)) {
+                       ret = send(qc->fd, b_peek(buf, b_head_ofs(buf)), sz,
+                                  MSG_DONTWAIT | MSG_NOSIGNAL);
+               }
+               else {
+                       ret = sendto(qc->li->rx.fd, b_peek(buf, b_head_ofs(buf)), sz,
+                                    MSG_DONTWAIT|MSG_NOSIGNAL,
+                                    (struct sockaddr *)&qc->peer_addr,
+                                    get_addr_len(&qc->peer_addr));
+               }
        } while (ret < 0 && errno == EINTR);
 
        if (ret < 0 || ret != sz) {
@@ -515,7 +522,9 @@ int qc_snd_buf(struct quic_conn *qc, const struct buffer *buf, size_t sz,
                                HA_ATOMIC_INC(&prx_counters->sendto_err);
                }
                else if (errno) {
-                       /* TODO unlisted errno : handle it explicitly. */
+                       /* TODO unlisted errno : handle it explicitly.
+                        * ECONNRESET may be encounter on quic-conn socket.
+                        */
                        HA_ATOMIC_INC(&prx_counters->sendto_err_unknown);
                }