mirror of
https://github.com/pion/webrtc.git
synced 2025-09-27 03:25:58 +08:00
Add option to disable close by dtls
Close peerconnection on DTLS.CloseNotify could break ice restart with dtls restart, when the dtls finger-print changed, the browser could teardown the old dtlstransport and establish new one then pion could close the peerconnection and restart failed. So browser don't do this and spec also don't say peerconnection should close when dtls is closed.
This commit is contained in:
@@ -394,3 +394,26 @@ func TestSetFireOnTrackBeforeFirstRTP(t *testing.T) {
|
||||
|
||||
closePairNow(t, offerer, answerer)
|
||||
}
|
||||
|
||||
func TestDisableCloseByDTLS(t *testing.T) {
|
||||
lim := test.TimeOut(time.Second * 30)
|
||||
defer lim.Stop()
|
||||
|
||||
report := test.CheckRoutines(t)
|
||||
defer report()
|
||||
|
||||
s := SettingEngine{}
|
||||
s.DisableCloseByDTLS(true)
|
||||
|
||||
offer, answer, err := NewAPI(WithSettingEngine(s)).newPair(Configuration{})
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.NoError(t, signalPair(offer, answer))
|
||||
|
||||
untilConnectionState(PeerConnectionStateConnected, offer, answer).Wait()
|
||||
assert.NoError(t, answer.Close())
|
||||
|
||||
time.Sleep(time.Second)
|
||||
assert.True(t, offer.ConnectionState() == PeerConnectionStateConnected)
|
||||
assert.NoError(t, offer.Close())
|
||||
}
|
||||
|
Reference in New Issue
Block a user