commit 0c2ab25864c803fbffe8bb23cfdcb0a01f93381c Author: Arlo Breault arlolra@gmail.com Date: Wed May 6 12:42:30 2020 -0400
Handle onicecandidate firing after connection closed
This might just be an issue with node-webrtc but seems a harmless workaround.
Trac: 34126 --- proxypair.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/proxypair.js b/proxypair.js index 25eaa9d..afcacb1 100644 --- a/proxypair.js +++ b/proxypair.js @@ -46,11 +46,11 @@ class ProxyPair { }); this.pc.onicecandidate = (evt) => { // Browser sends a null candidate once the ICE gathering completes. - if (null === evt.candidate) { + if (null === evt.candidate && this.pc.connectionState !== 'closed') { // TODO: Use a promise.all to tell Snowflake about all offers at once, // once multiple proxypairs are supported. dbg('Finished gathering ICE candidates.'); - return snowflake.broker.sendAnswer(this.id, this.pc.localDescription); + snowflake.broker.sendAnswer(this.id, this.pc.localDescription); } }; // OnDataChannel triggered remotely from the client when connection succeeds.