Skip to content

Commit

Permalink
fix the lazy stress read test on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Mar 30, 2021
1 parent 7c6e444 commit d12fb32
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions multistream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func TestProtocolNegotiationLazy(t *testing.T) {
}

func TestNegLazyStressRead(t *testing.T) {
const count = 100
const count = 75

mux := NewMultistreamMuxer()
mux.AddHandler("/a", nil)
Expand All @@ -159,7 +159,9 @@ func TestNegLazyStressRead(t *testing.T) {

message := []byte("this is the message")
listener := make(chan io.ReadWriteCloser)
done := make(chan struct{})
go func() {
defer close(done)
for rwc := range listener {
m, selected, _, err := mux.NegotiateLazy(rwc)
if err != nil {
Expand All @@ -185,7 +187,6 @@ func TestNegLazyStressRead(t *testing.T) {
rwc.Close()
}
}()
defer func() { close(listener) }()

for i := 0; i < count; i++ {
a, b := newPipe(t)
Expand All @@ -198,8 +199,10 @@ func TestNegLazyStressRead(t *testing.T) {
t.Fatal(err)
}

b.Close()
defer b.Close()
}
close(listener)
<-done
}

func TestNegLazyStressWrite(t *testing.T) {
Expand Down

0 comments on commit d12fb32

Please sign in to comment.