Skip to content
Snippets Groups Projects
Commit ee912fa2 authored by Greg Fodor's avatar Greg Fodor
Browse files

Target specific sessions in request/response, deal with disconnect properly

parent 3e87d0d4
No related branches found
No related tags found
No related merge requests found
...@@ -33,6 +33,8 @@ export default class XferChannel { ...@@ -33,6 +33,8 @@ export default class XferChannel {
channel.on("xfer_expired", () => finished("expired")); channel.on("xfer_expired", () => finished("expired"));
channel.on("presence_state", state => { channel.on("presence_state", state => {
if (readyToSend) return;
if (Object.keys(state).length > 0) { if (Object.keys(state).length > 0) {
// Code is in use by someone else, try a new one // Code is in use by someone else, try a new one
step(); step();
...@@ -42,9 +44,9 @@ export default class XferChannel { ...@@ -42,9 +44,9 @@ export default class XferChannel {
} }
}); });
channel.on("xfer_request", () => { channel.on("xfer_request", incoming => {
if (readyToSend) { 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. // Copy profile data to xfer'ed device if it's been set.
if (this.store.state.activity.hasChangedName) { if (this.store.state.activity.hasChangedName) {
...@@ -80,7 +82,7 @@ export default class XferChannel { ...@@ -80,7 +82,7 @@ export default class XferChannel {
if (numOccupants === 1) { if (numOccupants === 1) {
// Great, only sender is in topic, request xfer // 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(() => { setTimeout(() => {
if (finished) return; if (finished) return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment