Skip to content

Commit

Permalink
Check returns properly for receiving offer
Browse files Browse the repository at this point in the history
Now that we're setting the active attribute of pair to true before
accepting a client offer, we should be careful to reset it to false if
receiving the offer fails
  • Loading branch information
cohosh committed Jul 3, 2019
1 parent f85316f commit 501c26b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions proxy/snowflake.coffee
Expand Up @@ -72,7 +72,11 @@ class Snowflake
@ui.setStatus msg
recv = @broker.getClientOffer pair.id
recv.then (desc) =>
if pair.running then @receiveOffer pair, desc
if pair.running
if !@receiveOffer pair, desc
pair.active = false
else
pair.active = false
, (err) ->
pair.active = false
@retries++
Expand All @@ -91,9 +95,14 @@ class Snowflake
offer = JSON.parse desc
dbg 'Received:\n\n' + offer.sdp + '\n'
sdp = new SessionDescription offer
@sendAnswer pair if pair.receiveWebRTCOffer sdp
if pair.receiveWebRTCOffer sdp
@sendAnswer pair
return true
else
return false
catch e
log 'ERROR: Unable to receive Offer: ' + e
return false

sendAnswer: (pair) ->
next = (sdp) ->
Expand Down

0 comments on commit 501c26b

Please sign in to comment.