From fb6af2a426e0a31bfae18efb5dc0c7b905bb9720 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 20 Apr 2020 14:00:10 +1000 Subject: [PATCH] Remove unused outbound offer answered field --- webtorrent/tracker_client.go | 6 ------ webtorrent/transport.go | 4 ---- 2 files changed, 10 deletions(-) diff --git a/webtorrent/tracker_client.go b/webtorrent/tracker_client.go index 13df300b..9644cf19 100644 --- a/webtorrent/tracker_client.go +++ b/webtorrent/tracker_client.go @@ -42,9 +42,6 @@ type outboundOffer struct { originalOffer webrtc.SessionDescription peerConnection wrappedPeerConnection dataChannel *webrtc.DataChannel - // Whether we've received an answer for this offer, and closing its PeerConnection has been - // handed off. - answered bool } type DataChannelContext struct { @@ -86,9 +83,6 @@ func (tc *TrackerClient) Run() error { func (tc *TrackerClient) closeUnusedOffers() { for _, offer := range tc.outboundOffers { - if offer.answered { - continue - } offer.peerConnection.Close() } tc.outboundOffers = nil diff --git a/webtorrent/transport.go b/webtorrent/transport.go index 809d2c13..37989b84 100644 --- a/webtorrent/transport.go +++ b/webtorrent/transport.go @@ -130,10 +130,6 @@ func getAnswerForOffer( func (t *outboundOffer) setAnswer(answer webrtc.SessionDescription, onOpen func(datachannel.ReadWriteCloser)) error { setDataChannelOnOpen(t.dataChannel, t.peerConnection, onOpen) err := t.peerConnection.SetRemoteDescription(answer) - if err == nil { - // TODO: Maybe grab this inside the onOpen callback and mark the offer used there. - t.answered = true - } return err } -- 2.44.0