From a21134d310fb182f955773f5bc218548ade25099 Mon Sep 17 00:00:00 2001 From: Jeroen van Veen <48799939+jvanveen@users.noreply.github.com> Date: Mon, 29 Aug 2022 20:06:01 +0200 Subject: [PATCH] Fix usage of serverConnection in protocol.js serverConnection is the global value in galene.js. --- static/protocol.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/static/protocol.js b/static/protocol.js index 3dc113e..222a2e0 100644 --- a/static/protocol.js +++ b/static/protocol.js @@ -1790,7 +1790,7 @@ TransferredFile.prototype.receive = async function() { throw new Error('Receiving in wrong direction'); if(f.pc) throw new Error('Download already in progress'); - let pc = new RTCPeerConnection(serverConnection.getRTCConfiguration()); + let pc = new RTCPeerConnection(f.sc.getRTCConfiguration()); if(!pc) { let err = new Error("Couldn't create peer connection"); f.fail(err); @@ -1807,7 +1807,7 @@ TransferredFile.prototype.receive = async function() { } }; pc.onicecandidate = function(e) { - serverConnection.userMessage('filetransfer', f.userid, { + f.sc.userMessage('filetransfer', f.userid, { type: 'downice', id: f.id, candidate: e.candidate, @@ -1851,7 +1851,7 @@ TransferredFile.prototype.answer = async function(sdp) { throw new Error('Sending file in wrong direction'); if(f.pc) throw new Error('Transfer already in progress'); - let pc = new RTCPeerConnection(serverConnection.getRTCConfiguration()); + let pc = new RTCPeerConnection(f.sc.getRTCConfiguration()); if(!pc) { let err = new Error("Couldn't create peer connection"); f.fail(err); @@ -1862,7 +1862,7 @@ TransferredFile.prototype.answer = async function(sdp) { f.candidates = []; pc.onicecandidate = function(e) { - serverConnection.userMessage('filetransfer', f.userid, { + f.sc.userMessage('filetransfer', f.userid, { type: 'upice', id: f.id, candidate: e.candidate, @@ -1910,7 +1910,7 @@ TransferredFile.prototype.answer = async function(sdp) { if(!answer) throw new Error("Couldn't create answer"); await pc.setLocalDescription(answer); - serverConnection.userMessage('filetransfer', f.userid, { + f.sc.userMessage('filetransfer', f.userid, { type: 'answer', id: f.id, sdp: pc.localDescription.sdp,