RFC6555 Happy Eyeballs: Success with Dual-Stack Hosts
RFC8305 Happy Eyeballs Version 2: Better Connectivity Using Concurrency
Happy Eyeballs 2 adds the following features on top of RFC6555
Asynchronous DNS queries.
The diagram below shows how the DNS queries are handled asynchronously. Implementations SHOULD NOT wait for both families of answers to return before attempting connection establishment. If one query fails to return or takes significantly longer to return, waiting for the second address family can significantly delay the connection establishment of the first one.
This is a workaround for faulty resolvers that take a long time to return results after AAAA queries are made.
Sorting of resolved destination addresses
Whichever address family is first in the list should be followed by an address of the other address family; that is, if the first address in the sorted list is IPv6, then the first IPv4 address should be moved up in the list to be second in the list.
Asynchronous connection attempts
After "Connection Attempt Delay" has passed after starting a connection attempt for an address, start a new connection attempt to the next address. This shouldn’t affect previous attempts, as multiple connection attempts may occur in parallel.