mirror of
https://github.com/pion/webrtc.git
synced 2025-09-27 03:25:58 +08:00
Close ICEGatherer if mux isn't ready
When ICE is completely connected closing the mux is the proper way to shut everything down. The Close is communicated down each transport. The ICETransport mux is only available once ICE has completed however. When shutting down the ICETransport if the mux isn't set close the ICEGatherer if it has been set. Resolves #608
This commit is contained in:
@@ -55,3 +55,37 @@ func TestPeerConnection_Close(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
// Assert that a PeerConnection that is shutdown before ICE starts doesn't leak
|
||||
func TestPeerConnection_Close_PreICE(t *testing.T) {
|
||||
// Limit runtime in case of deadlocks
|
||||
lim := test.TimeOut(time.Second * 20)
|
||||
defer lim.Stop()
|
||||
|
||||
report := test.CheckRoutines(t)
|
||||
defer report()
|
||||
|
||||
pcOffer, pcAnswer, err := newPair()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
answer, err := pcOffer.CreateOffer(nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
err = pcOffer.Close()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if err = pcAnswer.SetRemoteDescription(answer); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
err = pcAnswer.Close()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user