Commit 6df80387 authored by Burcu Dogan's avatar Burcu Dogan

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/20340Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent e8531316
...@@ -178,7 +178,14 @@ func testGoroutineParallelism2(t *testing.T, load, netpoll bool) { ...@@ -178,7 +178,14 @@ func testGoroutineParallelism2(t *testing.T, load, netpoll bool) {
} }
if netpoll { if netpoll {
// Enable netpoller, affects schedler behavior. // 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 { if err != nil {
defer ln.Close() // yup, defer in a loop defer ln.Close() // yup, defer in a loop
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment