mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: listen 127.0.0.1 instead of localhost on android
Fixes #14486. Related to #14485. Change-Id: I2dd77b0337aebfe885ae828483deeaacb500b12a Reviewed-on: https://go-review.googlesource.com/20340 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
e853131699
commit
6df8038768
1 changed files with 8 additions and 1 deletions
|
|
@ -178,7 +178,14 @@ func testGoroutineParallelism2(t *testing.T, load, netpoll bool) {
|
|||
}
|
||||
if netpoll {
|
||||
// Enable netpoller, affects schedler behavior.
|
||||
ln, err := net.Listen("tcp", "localhost:0")
|
||||
laddr := "localhost:0"
|
||||
if runtime.GOOS == "android" {
|
||||
// On some Android devices, there are no records for localhost,
|
||||
// see https://golang.org/issues/14486.
|
||||
// Don't use 127.0.0.1 for every case, it won't work on IPv6-only systems.
|
||||
laddr = "127.0.0.1:0"
|
||||
}
|
||||
ln, err := net.Listen("tcp", laddr)
|
||||
if err != nil {
|
||||
defer ln.Close() // yup, defer in a loop
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue