From a8d47fd1bf489a25a18980b70b12720642e5e042 Mon Sep 17 00:00:00 2001 From: Sergey Stepanov Date: Wed, 18 Oct 2023 20:42:46 +0300 Subject: [PATCH] Don't nil peerconnection while receiving ICE --- pkg/network/webrtc/webrtc.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/network/webrtc/webrtc.go b/pkg/network/webrtc/webrtc.go index d05b07c3..ed0c3ca6 100644 --- a/pkg/network/webrtc/webrtc.go +++ b/pkg/network/webrtc/webrtc.go @@ -185,6 +185,9 @@ func (p *Peer) handleICEState(onConnect func()) func(webrtc.ICEConnectionState) } func (p *Peer) AddCandidate(candidate string, decoder Decoder) error { + // !to add test when the connection is closed but it is still + // receiving ice candidates + var iceCandidate webrtc.ICECandidateInit if err := decoder(candidate, &iceCandidate); err != nil { return err @@ -204,7 +207,6 @@ func (p *Peer) Disconnect() { // ignore this due to DTLS fatal: conn is closed _ = p.conn.Close() } - p.conn = nil p.log.Debug().Msg("WebRTC stop") }