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

net: fix flaky test

The test failed on one of the builders with:
timeout_test.go:594: 	ln.Accept: accept tcp 127.0.0.1:19373: use of closed network connection
http://build.golang.org/log/e83f4a152b37071b9d079096e15913811ad296b5

R=golang-dev, bradfitz, dave, mikioh.mikioh, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/6859043
This commit is contained in:
Dmitriy Vyukov 2012-11-27 12:18:54 +04:00
parent 478aff3d4d
commit d6fd52c088

View File

@ -588,8 +588,10 @@ func TestProlongTimeout(t *testing.T) {
ln := newLocalListener(t)
defer ln.Close()
connected := make(chan bool)
go func() {
s, err := ln.Accept()
connected <- true
if err != nil {
t.Fatalf("ln.Accept: %v", err)
}
@ -619,6 +621,7 @@ func TestProlongTimeout(t *testing.T) {
t.Fatalf("DialTCP: %v", err)
}
defer c.Close()
<-connected
for i := 0; i < 1024; i++ {
var buf [1]byte
c.Write(buf[:])