From ee912fa2aebfaa97a47d8e34ef48e687f2ecc243 Mon Sep 17 00:00:00 2001 From: Greg Fodor <gfodor@gmail.com> Date: Sun, 6 May 2018 22:17:37 -0700 Subject: [PATCH] Target specific sessions in request/response, deal with disconnect properly --- src/utils/xfer-channel.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/utils/xfer-channel.js b/src/utils/xfer-channel.js index 4f6b485eb..15c4c0fc2 100644 --- a/src/utils/xfer-channel.js +++ b/src/utils/xfer-channel.js @@ -33,6 +33,8 @@ export default class XferChannel { channel.on("xfer_expired", () => finished("expired")); channel.on("presence_state", state => { + if (readyToSend) return; + if (Object.keys(state).length > 0) { // Code is in use by someone else, try a new one step(); @@ -42,9 +44,9 @@ export default class XferChannel { } }); - channel.on("xfer_request", () => { + channel.on("xfer_request", incoming => { if (readyToSend) { - const payload = { path: location.pathname }; + const payload = { path: location.pathname, target_session_id: incoming.reply_to_session_id }; // Copy profile data to xfer'ed device if it's been set. if (this.store.state.activity.hasChangedName) { @@ -80,7 +82,7 @@ export default class XferChannel { if (numOccupants === 1) { // Great, only sender is in topic, request xfer - channel.push("xfer_request", {}); + channel.push("xfer_request", { reply_to_session_id: this.socket.params.session_id }); setTimeout(() => { if (finished) return; -- GitLab