From 33b1814bc7f7d5094cb89d757e12dc516dba1c33 Mon Sep 17 00:00:00 2001 From: Bashar Eid Date: Thu, 30 Jan 2025 16:39:33 -0500 Subject: [PATCH] only close if connection is not shared --- rpc/wrtc_signaling_answerer.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rpc/wrtc_signaling_answerer.go b/rpc/wrtc_signaling_answerer.go index dd432496..176fba8d 100644 --- a/rpc/wrtc_signaling_answerer.go +++ b/rpc/wrtc_signaling_answerer.go @@ -270,9 +270,11 @@ func (ans *webrtcSignalingAnswerer) Stop() { ans.connMu.Lock() defer ans.connMu.Unlock() if ans.conn != nil { - err := ans.conn.Close() - if isNetworkError(err) { - ans.logger.Errorw("error closing signaling connection", "error", err) + if !ans.sharedConn { + err := ans.conn.Close() + if isNetworkError(err) { + ans.logger.Errorw("error closing signaling connection", "error", err) + } } ans.conn = nil }