From a49914b2536bb50f57904385a2d016e267e92fa2 Mon Sep 17 00:00:00 2001 From: Eric Daniels Date: Wed, 14 Aug 2024 14:36:23 -0400 Subject: [PATCH] Revert "Run ops.GracefulClose earlier in pc.Close" This reverts commit 887b10f2641dd140b62550671c151d8ff42fb10f. --- peerconnection.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/peerconnection.go b/peerconnection.go index 7501b4f4486..3b40dafecb6 100644 --- a/peerconnection.go +++ b/peerconnection.go @@ -2113,7 +2113,6 @@ func (pc *PeerConnection) close(shouldGracefullyClose bool) error { } if shouldGracefullyClose && !alreadyGracefullyClosed { defer close(pc.isGracefulClosedDone) - pc.ops.GracefulClose() } // https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-close (step #3) @@ -2170,6 +2169,8 @@ func (pc *PeerConnection) close(shouldGracefullyClose bool) error { pc.updateConnectionState(pc.ICEConnectionState(), pc.dtlsTransport.State()) if shouldGracefullyClose { + pc.ops.GracefulClose() + // note that it isn't canon to stop gracefully pc.sctpTransport.lock.Lock() for _, d := range pc.sctpTransport.dataChannels {