Skip to content

Commit

Permalink
Run ops.GracefulClose earlier in pc.Close
Browse files Browse the repository at this point in the history
  • Loading branch information
edaniels committed Aug 13, 2024
1 parent 4e4a67d commit 887b10f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions peerconnection.go
Original file line number Diff line number Diff line change
Expand Up @@ -2113,6 +2113,7 @@ 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)
Expand Down Expand Up @@ -2169,8 +2170,6 @@ 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 {
Expand Down

0 comments on commit 887b10f

Please sign in to comment.