Initialize arrays when constructing

Otherwise, this is set on the prototype and shared across instances :/

Note the change to the test that highlights this bug.  A proxy pair was
already created when an earlier test called `beginWebRTC()` but a new
Snowflake instance should start with an empty array.
This commit is contained in:
Arlo Breault 2019-05-08 13:29:23 -04:00
parent 9df66b15b1
commit 3839c2e0b1
3 changed files with 4 additions and 5 deletions

View file

@ -12,7 +12,6 @@ TODO: More documentation
# Minimum viable snowflake for now - just 1 client.
class Snowflake
relayAddr: null
proxyPairs: []
rateLimit: null
retries: 0
@ -25,6 +24,7 @@ class Snowflake
# Prepare the Snowflake with a Broker (to find clients) and optional UI.
constructor: (@broker, @ui) ->
@state = Snowflake.MODE.INIT
@proxyPairs = []
rateLimitBytes = undefined
if 'off' != query['ratelimit']