• Martin Storsjö's avatar
    network: Add RFC 8305 style "Happy Eyeballs"/"Fast Fallback" helper function · 9b4c3f5a
    Martin Storsjö authored
    For cases with dual stack (IPv4 + IPv6) connectivity, but where one
    stack potentially is less reliable, strive to trying to connect over
    both protocols in parallel, using whichever address connected first.
    
    In cases with a hostname resolving to multiple IPv4 and IPv6
    addresses, the current connection mechanism would try all addresses
    in the order returned by getaddrinfo (with all IPv6 addresses ordered
    before the IPv4 addresses normally). If connection attempts to the
    IPv6 addresses return quickly with an error, this was no problem, but
    if they were unsuccessful leading up to timeouts, the connection process
    would have to wait for timeouts on all IPv6 target addresses before
    attempting any IPv4 address.
    
    Similar to what RFC 8305 suggests, reorder the list of addresses to
    try connecting to, interleaving address families. After starting one
    connection attempt, start another one in parallel after a small delay
    (200 ms as suggested by the RFC).
    
    For cases with unreliable IPv6 but reliable IPv4, this should make
    connection attempts work as reliably as with plain IPv4, with only an
    extra 200 ms of connection delay.
    Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
    9b4c3f5a
Name
Last commit
Last update
avbuild Loading commit data...
avtools Loading commit data...
compat Loading commit data...
doc Loading commit data...
libavcodec Loading commit data...
libavdevice Loading commit data...
libavfilter Loading commit data...
libavformat Loading commit data...
libavresample Loading commit data...
libavutil Loading commit data...
libswscale Loading commit data...
presets Loading commit data...
tests Loading commit data...
tools Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.travis.yml Loading commit data...
COPYING.GPLv2 Loading commit data...
COPYING.GPLv3 Loading commit data...
COPYING.LGPLv2.1 Loading commit data...
COPYING.LGPLv3 Loading commit data...
CREDITS Loading commit data...
Changelog Loading commit data...
INSTALL Loading commit data...
LICENSE Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
RELEASE Loading commit data...
configure Loading commit data...