-
Notifications
You must be signed in to change notification settings - Fork 17.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net: add sequential and RFC 6555-compliant TCP dialing.
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/8768 Reviewed-by: Mikio Hara <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
- Loading branch information
Paul Marks
committed
Jun 16, 2015
1 parent
12b05bf
commit 0d8366e
Showing
4 changed files
with
566 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.