-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(iroh): Poll all AsyncUdpSocket sources fairly (#2996)
## Description The existing AsyncUdpSocket::poll_recv polled the UDP IPv4 socket first, only if that has no datagrams would it poll UDP IPv6 and only also that had no datagrams to deliver was the relay socket polled. This highly favoured IPv4 relay traffic, potentially starving the relay traffic. This change makes it prefer a different source on each poll. Meaning if multiple sockets have data to deliver a fairer delivery happens. Closes #2981. ## Breaking Changes <!-- Optional, if there are any breaking changes document them, including how to migrate older code. --> ## Notes & open questions - Using Ordering::Relaxed is probably fine. I believe normally this polling would only happen from a single task (the Quinn endpoint driver) and even if it was polled concurrently from different threads it would not be that bad and still an improvement on the current order. - I'm not particularly fond of the implementation, but the macros is the best I could come up with. Maybe there's something cleverer which can be done. ## Change checklist - [x] Self-review. - [x] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [x] Tests if relevant. - [x] All breaking changes documented. --------- Co-authored-by: Philipp Krüger <philipp.krueger1@gmail.com>
- Loading branch information
Showing
1 changed file
with
118 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters