Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
base repository: cohosh/snowflake
base: master
head repository: cohosh/snowflake
compare: bug31385
Checking mergeability… Don’t worry, you can still create the pull request.
  • 2 commits
  • 3 files changed
  • 0 comments
  • 1 contributor
Commits on Aug 23, 2019
This fixes a bug reported in #31385. There was an error with the proxy
deadlock fix in #31100 where we close proxies regardless of connection
status.
Commits on Aug 24, 2019
Because the timeout makes the pair inactive, we should check for this
state in onopen before connecting to the client. Updated tests to set
the proxy pair to active before testing onopen. Also removed a
redundant statement.
Showing with 10 additions and 6 deletions.
  1. +3 −0 proxy/proxypair.js
  2. +6 −6 proxy/snowflake.js
  3. +1 −0 proxy/spec/proxypair.spec.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);
@@ -78,14 +78,14 @@ class Snowflake {
if (!this.receiveOffer(pair, desc)) {
return pair.active = false;
}
//set a timeout for channel creation
//set a timeout for channel creation
return setTimeout((() => {
log('proxypair datachannel timed out waiting for open');
pair.close();
return pair.active = false;
if (!pair.running) {
log('proxypair datachannel timed out waiting for open');
pair.close();
return pair.active = false;
}
}), 20000); // 20 second timeout
} else {
return pair.active = false;
}
}, function() {
return pair.active = false;
@@ -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();
});

No commit comments for this range