1
0
mirror of https://github.com/golang/go synced 2024-11-26 05:07:59 -07:00

net: fix BenchmarkWriteToReadFromUDP on Windows

Using 0.0.0.0 for ListenUDP listens on all addresses. Calling LocalAddr
on that Conn returns 0.0.0.0. Sending to 0.0.0.0 doesn't seem to work on
Windows. See #22827.

Change-Id: I4a48fbabe65a63e07600a65309977cec08a9c1e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/301850
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Trust: Filippo Valsorda <filippo@golang.org>
This commit is contained in:
Filippo Valsorda 2021-03-15 23:10:21 +01:00 committed by David Chase
parent de2b27dee7
commit 661f3f15d5

View File

@ -447,7 +447,7 @@ func TestUDPReadSizeError(t *testing.T) {
}
func BenchmarkWriteToReadFromUDP(b *testing.B) {
conn, err := ListenUDP("udp4", new(UDPAddr))
conn, err := ListenUDP("udp4", &UDPAddr{IP: IPv4(127, 0, 0, 1)})
if err != nil {
b.Fatal(err)
}