]> Cypherpunks repositories - gostls13.git/commit
net: limit concurrent threads to limit on file descriptors
authorIan Lance Taylor <iant@golang.org>
Wed, 27 Jun 2018 14:08:41 +0000 (07:08 -0700)
committerIan Lance Taylor <iant@golang.org>
Wed, 27 Jun 2018 16:59:22 +0000 (16:59 +0000)
commitb749845067a2f59d3ffa215b83286272d38398ca
tree55ea89be01843b31d787fb7e71818c039c3a5162
parent7c4c87c015e566b7b172c613ef4fcc9669d936f6
net: limit concurrent threads to limit on file descriptors

At least on Darwin, if getaddrinfo can't open a file descriptor it
returns EAI_NONAME ("no such host") rather than a meaningful error.
Limit the number of concurrent getaddrinfo calls to the number of file
descriptors we can open, to make that meaningless error less likely.

We don't apply the same limit to Go lookups, because for that we will
return a meaningful "too many open files" error.

Fixes #25694

Change-Id: I601857190aeb64f11e22b4a834c1c6a722a0788d
Reviewed-on: https://go-review.googlesource.com/121176
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/net/lookup_fake.go
src/net/lookup_plan9.go
src/net/lookup_unix.go
src/net/lookup_windows.go
src/net/net.go