From 48a2e5a0cc87fd675a428ca2eae43107fa513ef3 Mon Sep 17 00:00:00 2001 From: Eric Daniels Date: Wed, 14 Aug 2024 14:36:04 -0400 Subject: [PATCH] Revert "Run ops.GracefulClose earlier in pc.Close" This reverts commit ec6b6f1d54085a2e22def1fbb946b76bdb203999. --- peerconnection.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/peerconnection.go b/peerconnection.go index 7d212f07c32..60edfa2ea88 100644 --- a/peerconnection.go +++ b/peerconnection.go @@ -2123,7 +2123,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) @@ -2180,6 +2179,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 {