mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-23 00:06:18 -04:00
if user actively disconnects from PairDrop server, disconnect all peer to peer connections immediately and do not wait for channels to close
This commit is contained in:
parent
1eba7359d1
commit
414cc9aa57
3 changed files with 27 additions and 15 deletions
|
@ -68,7 +68,7 @@ class ServerConnection {
|
|||
Events.fire('peer-joined', msg);
|
||||
break;
|
||||
case 'peer-left':
|
||||
Events.fire('peer-left', msg.peerId);
|
||||
Events.fire('peer-left', msg);
|
||||
break;
|
||||
case 'signal':
|
||||
Events.fire('signal', msg);
|
||||
|
@ -766,6 +766,16 @@ class PeersManager {
|
|||
this.peers[message.to].sendText(message.text);
|
||||
}
|
||||
|
||||
_onPeerLeft(msg) {
|
||||
if (this.peers[msg.peerId] && !this.peers[msg.peerId].rtcSupported) {
|
||||
console.log('WSPeer left:', msg.peerId)
|
||||
Events.fire('peer-disconnected', msg.peerId)
|
||||
} else if (msg.disconnect === true) {
|
||||
// if user actively disconnected from PairDrop server, disconnect all peer to peer connections immediately
|
||||
Events.fire('peer-disconnected', msg.peerId);
|
||||
}
|
||||
}
|
||||
|
||||
_onPeerDisconnected(peerId) {
|
||||
const peer = this.peers[peerId];
|
||||
delete this.peers[peerId];
|
||||
|
@ -775,13 +785,6 @@ class PeersManager {
|
|||
peer._busy = false;
|
||||
}
|
||||
|
||||
_onPeerLeft(peerId) {
|
||||
if (!this.peers[peerId]?.rtcSupported) {
|
||||
console.log('WSPeer left:', peerId)
|
||||
Events.fire('peer-disconnected', peerId)
|
||||
}
|
||||
}
|
||||
|
||||
_onSecretRoomDeleted(roomSecret) {
|
||||
for (const peerId in this.peers) {
|
||||
const peer = this.peers[peerId];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue