Close data channel on offer init errors

This commit is contained in:
Matt Joiner 2022-07-12 11:46:03 +10:00
parent 3aa2320442
commit 309a900b9a
No known key found for this signature in database
GPG Key ID: 6B990B8185E7F782
2 changed files with 3 additions and 0 deletions

View File

@ -234,6 +234,7 @@ func (tc *TrackerClient) Announce(event tracker.AnnounceEvent, infoHash [20]byte
}},
})
if err != nil {
dc.Close()
pc.Close()
}
return err

View File

@ -127,12 +127,14 @@ func (tc *TrackerClient) newOffer(
offer, err = peerConnection.CreateOffer(nil)
if err != nil {
dataChannel.Close()
peerConnection.Close()
return
}
offer, err = setAndGatherLocalDescription(peerConnection, offer)
if err != nil {
dataChannel.Close()
peerConnection.Close()
}
return