sessions Destroy log error.

This commit is contained in:
Miroslav Šedivý 2020-10-28 21:50:47 +01:00
parent f521373f9b
commit f751cba428

View File

@ -151,13 +151,17 @@ 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")
manager.sessions.Destroy(id) if err = manager.sessions.Destroy(id); err != nil {
manager.logger.Warn().Err(err).Msg("error while destroying session")
}
break break
case webrtc.PeerConnectionStateConnected: case webrtc.PeerConnectionStateConnected:
manager.logger.Info().Str("id", id).Msg("peer connected") manager.logger.Info().Str("id", id).Msg("peer connected")
if err = session.SetConnected(true); err != nil { if err = session.SetConnected(true); err != nil {
manager.logger.Warn().Err(err).Msg("unable to set connected on peer") manager.logger.Warn().Err(err).Msg("unable to set connected on peer")
manager.sessions.Destroy(id) if err = manager.sessions.Destroy(id); err != nil {
manager.logger.Warn().Err(err).Msg("error while destroying session")
}
} }
break break
} }