diff --git a/association_test.go b/association_test.go index d02bb9ca..26bcbaf6 100644 --- a/association_test.go +++ b/association_test.go @@ -2168,6 +2168,7 @@ func TestAssocReset(t *testing.T) { _, _, err = s0.ReadSCTP(buf) assert.Equal(t, io.EOF, err, "should be EOF") doneCh <- err + return } }() @@ -2841,6 +2842,15 @@ func TestAssociation_Abort(t *testing.T) { i, err = s21.Read(buf) assert.Equal(t, i, 0, "expected no data read") assert.Error(t, err, "User Initiated Abort: 1234", "expected abort reason") + + // Ensure a1 has closed down as well (avoid goroutine leak). + select { + case <-a1.readLoopCloseCh: + case <-time.After(1 * time.Second): + assert.Fail(t, "timed out waiting for a1 read loop to close") + } + + time.Sleep(time.Millisecond) // give readLoop a ms to completely exit. } func TestAssociation_OpenStreamAfterCloseMustNotHang(t *testing.T) {