• Paul Marks's avatar
    net: add sequential and RFC 6555-compliant TCP dialing. · 0d8366e2
    Paul Marks authored
    dialSerial connects to a list of addresses in sequence.  If a
    timeout is specified, then each address gets an equal fraction of the
    remaining time, with a magic constant (2 seconds) to prevent
    "dial a million addresses" from allotting zero time to each.
    
    Normally, net.Dial passes the DNS stub resolver's output to dialSerial.
    If an error occurs (like destination/port unreachable), it quickly skips
    to the next address, but a blackhole in the network will cause the
    connection to hang until the timeout elapses.  This is how UNIXy clients
    traditionally behave, and is usually sufficient for non-broken networks.
    
    The DualStack flag enables dialParallel, which implements Happy Eyeballs
    by racing two dialSerial goroutines, giving the preferred family a
    head start (300ms by default).  This allows clients to avoid long
    timeouts when the network blackholes IPv4 xor IPv6.
    
    Fixes #8453
    Fixes #8455
    Fixes #8847
    
    Change-Id: Ie415809c9226a1f7342b0217dcdd8f224ae19058
    Reviewed-on: https://go-review.googlesource.com/8768Reviewed-by: 's avatarMikio Hara <mikioh.mikioh@gmail.com>
    Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    0d8366e2
Name
Last commit
Last update
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...