[tor-commits] [snowflake-webext/master] Handle onicecandidate firing after connection closed

arlo at torproject.org arlo at torproject.org
Thu May 7 14:41:02 UTC 2020


commit 0c2ab25864c803fbffe8bb23cfdcb0a01f93381c
Author: Arlo Breault <arlolra at 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.



More information about the tor-commits mailing list