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.
This commit is contained in:
Amaury Denoyelle 2022-11-21 14:48:57 +01:00
parent 40909dfec5
commit dc0dcb394b

View File

@ -495,9 +495,16 @@ int qc_snd_buf(struct quic_conn *qc, const struct buffer *buf, size_t sz,
ssize_t ret; ssize_t ret;
do { do {
ret = sendto(qc->li->rx.fd, b_peek(buf, b_head_ofs(buf)), sz, if (qc_test_fd(qc)) {
MSG_DONTWAIT | MSG_NOSIGNAL, ret = send(qc->fd, b_peek(buf, b_head_ofs(buf)), sz,
(struct sockaddr *)&qc->peer_addr, get_addr_len(&qc->peer_addr)); 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); } while (ret < 0 && errno == EINTR);
if (ret < 0 || ret != sz) { 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); HA_ATOMIC_INC(&prx_counters->sendto_err);
} }
else if (errno) { 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); HA_ATOMIC_INC(&prx_counters->sendto_err_unknown);
} }