]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Remove unused outbound offer answered field
authorMatt Joiner <anacrolix@gmail.com>
Mon, 20 Apr 2020 04:00:10 +0000 (14:00 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 20 Apr 2020 04:00:10 +0000 (14:00 +1000)
webtorrent/tracker_client.go
webtorrent/transport.go

index 13df300b88eea900286cf4199b06657e4194dbec..9644cf19ace48f6b037850c67b199f06df5eed84 100644 (file)
@@ -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
index 809d2c13966f45e3057c39e67372ea82c1d462b9..37989b842e56c046945563172640ea322a892bc8 100644 (file)
@@ -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
 }