peer close simplified logging.

This commit is contained in:
Miroslav Šedivý 2021-09-02 21:58:00 +02:00
parent c85d00e507
commit 75c1dd6d22
2 changed files with 4 additions and 10 deletions

View File

@ -74,11 +74,8 @@ func (peer *WebRTCPeerCtx) Destroy() {
// TODO: Send webrtc disconnect event via websocket.
if err := peer.connection.Close(); err != nil {
peer.logger.Warn().Err(err).Msg("peer connection destroyed with an error")
} else {
peer.logger.Info().Msg("peer connection destroyed")
}
err := peer.connection.Close()
peer.logger.Err(err).Msg("peer connection destroyed")
peer.connection = nil
}

View File

@ -80,11 +80,8 @@ func (peer *WebSocketPeerCtx) Destroy(reason string) {
Message: reason,
})
if err := peer.connection.Close(); err != nil {
peer.logger.Warn().Err(err).Msg("peer connection destroyed with an error")
} else {
peer.logger.Info().Msg("peer connection destroyed")
}
err := peer.connection.Close()
peer.logger.Err(err).Msg("peer connection destroyed")
peer.connection = nil
}