`neqo_glue` first asks the Neqo connection state machine for outbound
UDP datagrams (`conn.process_output`) and then sends each on a UDP
socket. It does so in a loop. Previously, in case the second step fails
with WOULD_BLOCK, `neqo_glue` would simply dropp the datagram, relying
on QUIC's retransmit mechanism for the data to be delivered eventually
in consecutive UDP datagrams.
The above "local" packet drops lead to unnecessary congestion window
reductions due to packet loss. This is especially relevant on high
throughput uploads, where `neqo_glue` might fill the OS UDP socket send
buffer frequently, thus leading to many WOULD_BLOCKs, thus leading to
many datagram drops, thus leading to many congestion control window
reductions. Such scenario is for example detailed in the conversation
below:
https://bugzilla.mozilla.org/show_bug.cgi?id=1852924#c38
With this commit `neqo_glue` temporarily buffers the datagram on WOULD_BLOCK and
instructs the `nsUDPSocket` to be polled with PR_POLL_WRITE, i.e. be polled for
being writable. Once writable, `neqo_glue` is called back and the buffered
datagram is sent, before proceeding as usual.
Differential Revision: https://phabricator.services.mozilla.com/D239162