destroy only if is WebRTC active.

This commit is contained in:
Miroslav Šedivý 2020-12-05 21:05:09 +01:00
parent feb07b97ab
commit 22407825fe

View File

@ -123,9 +123,10 @@ func (session *SessionCtx) SetWebSocketConnected(connected bool) {
session.manager.emmiter.Emit("disconnected", session) session.manager.emmiter.Emit("disconnected", session)
session.websocket_peer = nil session.websocket_peer = nil
// TODO: Refactor. Only if is WebRTC active. if session.webrtc_peer != nil {
if err := session.webrtc_peer.Destroy(); err != nil { if err := session.webrtc_peer.Destroy(); err != nil {
session.logger.Warn().Err(err).Msgf("webrtc destroy has failed") session.logger.Warn().Err(err).Msgf("webrtc destroy has failed")
}
} }
} }