On Tue, Oct 10, 2017 at 11:12:16PM +0200, Ludens wrote: > On Sat, 7 Oct 2017 23:28:57 +0200 Julian Andres Klode <j...@debian.org> > wrote: > > JFTR: I wrote an implementation of parts of happy eyeballs for another > > bug we should probably merge in here, but it fails the test suite on > > CI: https://github.com/julian-klode/apt/commits/bugfix/happy-eyeballs > > > > I started a rewrite of that in another local branch, but it's not > > done yet. > > Hi, > > I started some work on this without knowing about the code that was > there. The patch attached implements Happy Eyeballs in (roughly) the > following way: > > In ConnectToHostname, if the first DoConnect does not complete within > 300ms, another DoConnect is performed with an address of a different IP > family. So, if the first DoConnect used IPv6, the second will use IPv4 > and vice versa. Of these two connection attempts, the first one that > completes will be used. The precedence ordering of getaddrinfo is also > taken into account. Hopefully, this is helpful.
I looked at the patch, but it did not look very neatly structured to me - more like the rest of the code... ;). My second attempt now is: https://github.com/Debian/apt/compare/master...julian-klode:pu/happy-eyeballs?expand=1 It's basically building lists of Connection objects and waiting on these, using the first successful connection (and waiting only 300 ms after adding a preferred connection, and then waiting the specified time out after optionally adding a non-preferred connection family). That said, I do not have a system with broken IPv6 routing, so I can't really test it. It's also not entirely neat yet either... -- debian developer - deb.li/jak | jak-linux.org - free software dev ubuntu core developer i speak de, en