mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Snowflake badge works, and animates when serving client (issue #16) and some logging cleanups
This commit is contained in:
parent
caba2cc8f8
commit
21c38a04ce
5 changed files with 44 additions and 32 deletions
|
@ -118,7 +118,7 @@ class Snowflake
|
|||
@retries++
|
||||
recv.then (desc) =>
|
||||
offer = JSON.parse desc
|
||||
log 'Received:\n\n' + offer.sdp + '\n'
|
||||
dbg 'Received:\n\n' + offer.sdp + '\n'
|
||||
@receiveOffer offer
|
||||
, (err) ->
|
||||
countdown(err, DEFAULT_BROKER_POLL_INTERVAL / 1000)
|
||||
|
@ -133,7 +133,7 @@ class Snowflake
|
|||
|
||||
sendAnswer: =>
|
||||
next = (sdp) =>
|
||||
log 'webrtc: Answer ready.'
|
||||
dbg 'webrtc: Answer ready.'
|
||||
@proxyPair.pc.setLocalDescription sdp
|
||||
promise = @proxyPair.pc.createAnswer next
|
||||
promise.then next if promise
|
||||
|
@ -170,7 +170,7 @@ class Snowflake
|
|||
# Close all existing ProxyPairs and begin finding new clients from scratch.
|
||||
reset: ->
|
||||
@cease()
|
||||
log '\nSnowflake resetting...'
|
||||
log 'Snowflake resetting...'
|
||||
@retries = 0
|
||||
@beginWebRTC()
|
||||
|
||||
|
@ -178,7 +178,6 @@ snowflake = null
|
|||
broker = null
|
||||
ui = null
|
||||
|
||||
|
||||
# Signalling channel - just tells user to copy paste to the peer.
|
||||
# Eventually this should go over the broker.
|
||||
Signalling =
|
||||
|
@ -202,9 +201,11 @@ Signalling =
|
|||
|
||||
# Log to both console and UI if applicable.
|
||||
log = (msg) ->
|
||||
console.log msg
|
||||
console.log 'Snowflake: ' + msg
|
||||
ui.log msg
|
||||
|
||||
dbg = (msg) -> log msg if ui.debug
|
||||
|
||||
init = ->
|
||||
ui = new UI()
|
||||
log '== snowflake proxy =='
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue