From: Matt Joiner Date: Tue, 12 Jul 2022 01:46:03 +0000 (+1000) Subject: Close data channel on offer init errors X-Git-Tag: v1.47.0~1^2 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=309a900b9af7b107a04f2506e6fc514aca6ed6f1;p=btrtrc.git Close data channel on offer init errors --- diff --git a/webtorrent/tracker-client.go b/webtorrent/tracker-client.go index b0ca6c2c..195c06b0 100644 --- a/webtorrent/tracker-client.go +++ b/webtorrent/tracker-client.go @@ -234,6 +234,7 @@ func (tc *TrackerClient) Announce(event tracker.AnnounceEvent, infoHash [20]byte }}, }) if err != nil { + dc.Close() pc.Close() } return err diff --git a/webtorrent/transport.go b/webtorrent/transport.go index 85299086..d60fb7a7 100644 --- a/webtorrent/transport.go +++ b/webtorrent/transport.go @@ -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