From 75c1dd6d226ed234cde2a6a0f9cca9cc650e9faf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Thu, 2 Sep 2021 21:58:00 +0200 Subject: [PATCH] peer close simplified logging. --- internal/webrtc/peer.go | 7 ++----- internal/websocket/peer.go | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/internal/webrtc/peer.go b/internal/webrtc/peer.go index 3f030826..c7dd5fde 100644 --- a/internal/webrtc/peer.go +++ b/internal/webrtc/peer.go @@ -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 } diff --git a/internal/websocket/peer.go b/internal/websocket/peer.go index a449a601..266c974a 100644 --- a/internal/websocket/peer.go +++ b/internal/websocket/peer.go @@ -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 }