Skip to content

Commit

Permalink
fix memory allocation check in SubtestStreamReset (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann authored Apr 10, 2022
1 parent 91ccb30 commit f9a08ce
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions suites/mux/muxer_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,14 +476,19 @@ func SubtestStreamReset(t *testing.T, tr network.Multiplexer) {
defer b.Close()

wg.Add(1)
scopea := &peerScope{}
muxa, err := tr.NewConn(a, true, scopea)
if err != nil {
t.Error(err)
return
}
defer func() {
muxa.Close()
scopea.Check(t)
}()

go func() {
defer wg.Done()
scope := &peerScope{}
muxa, err := tr.NewConn(a, true, scope)
if err != nil {
t.Error(err)
return
}
s, err := muxa.OpenStream(context.Background())
if err != nil {
t.Error(err)
Expand All @@ -496,17 +501,16 @@ func SubtestStreamReset(t *testing.T, tr network.Multiplexer) {
t.Error("should have been stream reset")
}
s.Close()
scope.Check(t)
}()

scope := &peerScope{}
muxb, err := tr.NewConn(b, false, scope)
scopeb := &peerScope{}
muxb, err := tr.NewConn(b, false, scopeb)
if err != nil {
t.Fatal(err)
}
defer func() {
muxb.Close()
scope.Check(t)
scopeb.Check(t)
}()

str, err := muxb.AcceptStream()
Expand Down

0 comments on commit f9a08ce

Please sign in to comment.