webrtc peer do not set nil conn.

This commit is contained in:
Miroslav Šedivý 2023-04-17 22:38:03 +02:00
parent 5a2fcc1c8a
commit 43f8fe339f
2 changed files with 3 additions and 6 deletions

View File

@ -487,7 +487,7 @@ func (manager *WebRTCManagerCtx) CreatePeer(session types.Session, bitrate int,
session.SetWebRTCConnected(peer, true) session.SetWebRTCConnected(peer, true)
case webrtc.PeerConnectionStateDisconnected, case webrtc.PeerConnectionStateDisconnected,
webrtc.PeerConnectionStateFailed: webrtc.PeerConnectionStateFailed:
connection.Close() peer.Destroy()
case webrtc.PeerConnectionStateClosed: case webrtc.PeerConnectionStateClosed:
// ensure we only run this once // ensure we only run this once
once.Do(func() { once.Do(func() {

View File

@ -106,11 +106,8 @@ func (peer *WebRTCPeerCtx) Destroy() {
peer.mu.Lock() peer.mu.Lock()
defer peer.mu.Unlock() defer peer.mu.Unlock()
if peer.connection != nil { err := peer.connection.Close()
err := peer.connection.Close() peer.logger.Err(err).Msg("peer connection destroyed")
peer.logger.Err(err).Msg("peer connection destroyed")
peer.connection = nil
}
} }
func (peer *WebRTCPeerCtx) estimatorReader() { func (peer *WebRTCPeerCtx) estimatorReader() {