commit 6cc944f2b452db8e74843ba6644c95201d7873ac Author: Cecylia Bocovich cohosh@torproject.org Date: Wed Jul 17 09:22:23 2019 -0400
Reuse proxypair if sendAnswer fails
Make sure to set proxypair.active to false if createAnswer or setLocalDescription fails. This should prevent one edge case the results in an infinite loop described in ticket #31100. --- proxy/snowflake.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/proxy/snowflake.js b/proxy/snowflake.js index bbf3d8b..ae7aa2c 100644 --- a/proxy/snowflake.js +++ b/proxy/snowflake.js @@ -120,10 +120,11 @@ class Snowflake { var fail, next; next = function(sdp) { dbg('webrtc: Answer ready.'); - return pair.pc.setLocalDescription(sdp); + return pair.pc.setLocalDescription(sdp).catch(fail); }; fail = function() { - return dbg('webrtc: Failed to create Answer'); + pair.active = false + return dbg('webrtc: Failed to create or set Answer'); }; return pair.pc.createAnswer().then(next).catch(fail); }
tor-commits@lists.torproject.org