mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-22 07:46:17 -04:00
remove unnecessary double signaling onPeerJoined and prevent second RTCPeer instance for same peerId
This commit is contained in:
parent
0d47bf176a
commit
1c3a8bfe1d
1 changed files with 2 additions and 6 deletions
|
@ -467,7 +467,7 @@ class Peer {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Events.fire('file-transfer-accepted');
|
Events.fire('file-transfer-accepted');
|
||||||
Events.fire('set-progress', {peerId: this._peerId, progress: 1, status: 'transfer'});
|
Events.fire('set-progress', {peerId: this._peerId, progress: 0, status: 'transfer'});
|
||||||
this.sendFiles();
|
this.sendFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -644,7 +644,6 @@ class PeersManager {
|
||||||
Events.on('files-selected', e => this._onFilesSelected(e.detail));
|
Events.on('files-selected', e => this._onFilesSelected(e.detail));
|
||||||
Events.on('respond-to-files-transfer-request', e => this._onRespondToFileTransferRequest(e.detail))
|
Events.on('respond-to-files-transfer-request', e => this._onRespondToFileTransferRequest(e.detail))
|
||||||
Events.on('send-text', e => this._onSendText(e.detail));
|
Events.on('send-text', e => this._onSendText(e.detail));
|
||||||
Events.on('peer-joined', e => this._onPeerJoined(e.detail));
|
|
||||||
Events.on('peer-disconnected', e => this._onPeerLeft(e.detail));
|
Events.on('peer-disconnected', e => this._onPeerLeft(e.detail));
|
||||||
Events.on('secret-room-deleted', e => this._onSecretRoomDeleted(e.detail));
|
Events.on('secret-room-deleted', e => this._onSecretRoomDeleted(e.detail));
|
||||||
Events.on('beforeunload', e => this._onBeforeUnload(e));
|
Events.on('beforeunload', e => this._onBeforeUnload(e));
|
||||||
|
@ -674,6 +673,7 @@ class PeersManager {
|
||||||
// if different roomType -> abort
|
// if different roomType -> abort
|
||||||
if (this.peers[peer.id].roomType !== msg.roomType) return;
|
if (this.peers[peer.id].roomType !== msg.roomType) return;
|
||||||
this.peers[peer.id].refresh();
|
this.peers[peer.id].refresh();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
this.peers[peer.id] = new RTCPeer(this._server, peer.id, msg.roomType, msg.roomSecret);
|
this.peers[peer.id] = new RTCPeer(this._server, peer.id, msg.roomType, msg.roomSecret);
|
||||||
})
|
})
|
||||||
|
@ -707,10 +707,6 @@ class PeersManager {
|
||||||
this.peers[message.to].sendText(message.text);
|
this.peers[message.to].sendText(message.text);
|
||||||
}
|
}
|
||||||
|
|
||||||
_onPeerJoined(message) {
|
|
||||||
this._onMessage({sender: message.peer.id, roomType: message.roomType, roomSecret: message.roomSecret});
|
|
||||||
}
|
|
||||||
|
|
||||||
_onPeerLeft(peerId) {
|
_onPeerLeft(peerId) {
|
||||||
const peer = this.peers[peerId];
|
const peer = this.peers[peerId];
|
||||||
delete this.peers[peerId];
|
delete this.peers[peerId];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue