File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -573,6 +573,7 @@ func (a *Association) readLoop() {
573573 a .closeWriteLoopOnce .Do (func () { close (a .closeWriteLoopCh ) })
574574
575575 a .lock .Lock ()
576+ a .setState (closed )
576577 for _ , s := range a .streams {
577578 a .unregisterStream (s , closeErr )
578579 }
Original file line number Diff line number Diff line change @@ -3475,3 +3475,25 @@ func TestAssociation_OpenStreamAfterClose(t *testing.T) {
34753475 _ , err = a2 .OpenStream (1 , PayloadTypeWebRTCString )
34763476 require .ErrorIs (t , err , ErrAssociationClosed )
34773477}
3478+
3479+ // https://github.com/pion/sctp/pull/350
3480+ // may need to run with a high test count to reproduce if there
3481+ // is ever a regression.
3482+ func TestAssociation_OpenStreamAfterInternalClose (t * testing.T ) {
3483+ checkGoroutineLeaks (t )
3484+
3485+ a1 , a2 , err := createAssocs ()
3486+ require .NoError (t , err )
3487+
3488+ a1 .netConn .Close ()
3489+ a2 .netConn .Close ()
3490+
3491+ a1 .OpenStream (1 , PayloadTypeWebRTCString )
3492+ a2 .OpenStream (1 , PayloadTypeWebRTCString )
3493+
3494+ require .NoError (t , a1 .Close ())
3495+ require .NoError (t , a2 .Close ())
3496+
3497+ require .Equal (t , 0 , len (a1 .streams ))
3498+ require .Equal (t , 0 , len (a2 .streams ))
3499+ }
You can’t perform that action at this time.
0 commit comments