diff --git a/proxy/proxypair.js b/proxy/proxypair.js index 703ac27..fd5a39a 100644 --- a/proxy/proxypair.js +++ b/proxy/proxypair.js @@ -85,6 +85,9 @@ class ProxyPair { prepareDataChannel(channel) { channel.onopen = () => { log('WebRTC DataChannel opened!'); + if (!this.active) { + return + } this.running = true; snowflake.state = Snowflake.MODE.WEBRTC_READY; snowflake.ui.setActive(true); diff --git a/proxy/snowflake.js b/proxy/snowflake.js index 0edb42c..cdc59fb 100644 --- a/proxy/snowflake.js +++ b/proxy/snowflake.js @@ -86,8 +86,6 @@ class Snowflake { return pair.active = false; } }), 20000); // 20 second timeout - } else { - return pair.active = false; } }, function() { return pair.active = false; diff --git a/proxy/spec/proxypair.spec.js b/proxy/spec/proxypair.spec.js index 3716f2d..f15d6d2 100644 --- a/proxy/spec/proxypair.spec.js +++ b/proxy/spec/proxypair.spec.js @@ -100,6 +100,7 @@ describe('ProxyPair', function() { it('connects to the relay once datachannel opens', function() { spyOn(pp, 'connectRelay'); + pp.active = true; pp.client.onopen(); expect(pp.connectRelay).toHaveBeenCalled(); });