[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [snowflake/master] Check returns properly for receiving offer



commit 6210b5ea7fbbce33271c45f5cd209f1449b97067
Author: Cecylia Bocovich <cohosh@xxxxxxxxxxxxxx>
Date:   Wed Jul 3 13:15:03 2019 -0400

    Check returns properly for receiving offer
    
    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
---
 proxy/snowflake.coffee | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/proxy/snowflake.coffee b/proxy/snowflake.coffee
index 6062ca4..24e3cf7 100644
--- a/proxy/snowflake.coffee
+++ b/proxy/snowflake.coffee
@@ -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++
@@ -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) ->



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits