]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: quic: explicitely ignore sendto error
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 5 Aug 2022 13:22:28 +0000 (15:22 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 5 Aug 2022 13:45:25 +0000 (15:45 +0200)
commit906b0589546b700b532472ede019e5c5a8ac1f38
treea73ea11f8794608f011ac39d26ce5611a8b3e717
parente7df68a2198f0bf7aa3079b769f8e0fe38011306
MINOR: quic: explicitely ignore sendto error

qc_snd_buf() returns an error if sendto has failed. On standard
conditions, we should check for EAGAIN/EWOULDBLOCK errno and if so,
register the file-descriptor in the poller to retry the operation later.

However, quic_conn uses directly the listener fd which is shared for all
QUIC connections of this listener on several threads. Thus, it's
complicated to implement fd supversion via the poller : there is no
mechanism to easily wakeup quic_conn or MUX after a sendto failure.

A quick and simple solution for the moment is to considered a datagram
as properly emitted even on sendto error. In the end, this will trigger
the quic_conn retransmission timer as data will be considered lost on
the network and the send operation will be retried. This solution will
be replaced when fd management for quic_conn is reworked.

In fact, this quick hack was already in use in the current code, albeit
not voluntarily. This is due to a bug caused by an API mismatch on the
return type of qc_snd_buf() which never emits a negative error code
despite its documentation. Thus, all its invocation were considered as a
success. If this bug was fixed, the sending would would have been
interrupted by a break which could cause the transfer to freeze.

qc_snd_buf() invocation is clean up : the break statement is removed.
Send operation is now always explicitely conducted entirely even on
error and buffer data is purged.

A simple optimization has been added to skip over sendto when looping
over several datagrams at the first sendto error. However, to properly
function, it requires a fix on the return type of qc_snd_buf() which is
provided in another patch.

As the behavior before and after this patch seems identical, it is not
labelled as a BUG. However, it should be backported for cleaning
purpose. It may also have an impact on github issue #1808.
src/xprt_quic.c