webRTC WS disconnect error handling.

This commit is contained in:
Miroslav Šedivý 2020-10-31 21:56:20 +01:00
parent cca147859d
commit 5a25aefa34

View File

@ -149,7 +149,9 @@ func (manager *WebRTCManager) CreatePeer(id string, session types.Session) (stri
case webrtc.PeerConnectionStateDisconnected: case webrtc.PeerConnectionStateDisconnected:
case webrtc.PeerConnectionStateFailed: case webrtc.PeerConnectionStateFailed:
manager.logger.Info().Str("id", id).Msg("peer disconnected") manager.logger.Info().Str("id", id).Msg("peer disconnected")
session.Disconnect("peer connection state failed") if err:= session.Disconnect("peer connection state failed"); err != nil {
manager.logger.Warn().Err(err).Msg("error while disconnecting session")
}
case webrtc.PeerConnectionStateConnected: case webrtc.PeerConnectionStateConnected:
manager.logger.Info().Str("id", id).Msg("peer connected") manager.logger.Info().Str("id", id).Msg("peer connected")
session.SetConnected() session.SetConnected()