From: Amaury Denoyelle Date: Mon, 21 Nov 2022 13:48:57 +0000 (+0100) Subject: MINOR: quic: use connection socket for emission X-Git-Tag: v2.8-dev1~189 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dc0dcb394b4ae78243da85ce8778bc6220ac1107;p=thirdparty%2Fhaproxy.git MINOR: quic: use connection socket for emission 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. --- diff --git a/src/quic_sock.c b/src/quic_sock.c index bce8a1b1ae..7de961392e 100644 --- a/src/quic_sock.c +++ b/src/quic_sock.c @@ -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); }