mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Make MODE a class constant
This commit is contained in:
parent
6b002c5f22
commit
9df66b15b1
4 changed files with 20 additions and 19 deletions
|
@ -14,11 +14,18 @@ class Snowflake
|
|||
relayAddr: null
|
||||
proxyPairs: []
|
||||
rateLimit: null
|
||||
state: MODE.INIT
|
||||
retries: 0
|
||||
|
||||
# Janky state machine
|
||||
@MODE =
|
||||
INIT: 0
|
||||
WEBRTC_CONNECTING: 1
|
||||
WEBRTC_READY: 2
|
||||
|
||||
# Prepare the Snowflake with a Broker (to find clients) and optional UI.
|
||||
constructor: (@broker, @ui) ->
|
||||
@state = Snowflake.MODE.INIT
|
||||
|
||||
rateLimitBytes = undefined
|
||||
if 'off' != query['ratelimit']
|
||||
rateLimitBytes = Params.getByteCount(query, 'ratelimit',
|
||||
|
@ -41,7 +48,7 @@ class Snowflake
|
|||
# Initialize WebRTC PeerConnection, which requires beginning the signalling
|
||||
# process. |pollBroker| automatically arranges signalling.
|
||||
beginWebRTC: ->
|
||||
@state = MODE.WEBRTC_CONNECTING
|
||||
@state = Snowflake.MODE.WEBRTC_CONNECTING
|
||||
for i in [1..CONNECTIONS_PER_CLIENT]
|
||||
@makeProxyPair @relayAddr
|
||||
log 'ProxyPair Slots: ' + @proxyPairs.length
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue