diff --git a/internal/webrtc/manager.go b/internal/webrtc/manager.go index 6641904b..e0346383 100644 --- a/internal/webrtc/manager.go +++ b/internal/webrtc/manager.go @@ -153,15 +153,18 @@ func (manager *WebRTCManagerCtx) CreatePeer(session types.Session) (string, bool connection.OnConnectionStateChange(func(state webrtc.PeerConnectionState) { switch state { - case webrtc.PeerConnectionStateDisconnected: - manager.logger.Info().Str("id", session.ID()).Msg("peer disconnected successfully") - session.SetWebRTCConnected(false) - case webrtc.PeerConnectionStateFailed: - manager.logger.Warn().Str("id", session.ID()).Msg("peer disconnected with error") - session.SetWebRTCConnected(false) case webrtc.PeerConnectionStateConnected: manager.logger.Info().Str("id", session.ID()).Msg("peer connected") session.SetWebRTCConnected(true) + case webrtc.PeerConnectionStateDisconnected: + manager.logger.Info().Str("id", session.ID()).Msg("peer disconnected") + session.SetWebRTCConnected(false) + case webrtc.PeerConnectionStateFailed: + manager.logger.Warn().Str("id", session.ID()).Msg("peer failed") + session.SetWebRTCConnected(false) + case webrtc.PeerConnectionStateClosed: + manager.logger.Warn().Str("id", session.ID()).Msg("peer closed") + session.SetWebRTCConnected(false) } })