Don't nil peerconnection while receiving ICE

This commit is contained in:
Sergey Stepanov 2023-10-18 20:42:46 +03:00
parent 1b82c48dc1
commit a8d47fd1bf
No known key found for this signature in database
GPG key ID: A56B4929BAA8556B

View file

@ -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")
}