Comment 3 for bug 1308200

Revision history for this message
Julian Andres Klode (juliank) wrote :

Spent the day implementing a subset of Happy Eyeballs Version 2 (RFC 8305, https://tools.ietf.org/html/rfc8305) for APT. I initially started implementing a subset of its predecessor (RFC 6555, https://tools.ietf.org/html/rfc6555) half a year ago and reworked that today, but then I noticed the new RFC and switched to that.

The branch pu/happy-eyeballs2a (https://github.com/Debian/apt/compare/master...julian-klode:pu/happy-eyeballs2a?expand=1) implements it as following:

1. All addresses returned by getaddrinfo() are ordered so that preferred and non-prefered address families alternate (for example, IPv6, IPv4, IPv6, IPv4).
2. For each address, we attempt a connection and wait 250 ms for it and all previous attempts, storing all attempts in a list (vector currently). If one connection succeeds it is used.
3. If no connection succeeded, we wait another TimeOut for all attempts and use the result of that wait as the final result.

This means we easily fall back in cases of broken IPv6 routing, and also in situations where some hosts just refuse connections.