Overloading destroy method instead of having a separate method to remove video.
This commit is contained in:
parent
27ffb6b13d
commit
1162439479
@ -39,7 +39,7 @@ export class ScreenSharingPeer extends Peer {
|
|||||||
});*/
|
});*/
|
||||||
|
|
||||||
this.on('close', () => {
|
this.on('close', () => {
|
||||||
this.closeScreenSharingConnection();
|
this.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
@ -79,16 +79,16 @@ export class ScreenSharingPeer extends Peer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeScreenSharingConnection() {
|
public destroy(error?: Error): void {
|
||||||
try {
|
try {
|
||||||
mediaManager.removeActiveScreenSharingVideo(this.userId);
|
mediaManager.removeActiveScreenSharingVideo(this.userId);
|
||||||
// FIXME: I don't understand why "Closing connection with" message is displayed TWICE before "Nb users in peerConnectionArray"
|
// FIXME: I don't understand why "Closing connection with" message is displayed TWICE before "Nb users in peerConnectionArray"
|
||||||
// I do understand the method closeConnection is called twice, but I don't understand how they manage to run in parallel.
|
// I do understand the method closeConnection is called twice, but I don't understand how they manage to run in parallel.
|
||||||
//console.log('Closing connection with '+userId);
|
//console.log('Closing connection with '+userId);
|
||||||
this.destroy();
|
super.destroy(error);
|
||||||
//console.log('Nb users in peerConnectionArray '+this.PeerConnectionArray.size);
|
//console.log('Nb users in peerConnectionArray '+this.PeerConnectionArray.size);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("closeConnection", err)
|
console.error("ScreenSharingPeer::destroy", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ export class SimplePeer {
|
|||||||
console.warn("Tried to close connection for user "+userId+" but could not find user")
|
console.warn("Tried to close connection for user "+userId+" but could not find user")
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
peer.closeConnection();
|
peer.destroy();
|
||||||
// FIXME: I don't understand why "Closing connection with" message is displayed TWICE before "Nb users in peerConnectionArray"
|
// FIXME: I don't understand why "Closing connection with" message is displayed TWICE before "Nb users in peerConnectionArray"
|
||||||
// I do understand the method closeConnection is called twice, but I don't understand how they manage to run in parallel.
|
// I do understand the method closeConnection is called twice, but I don't understand how they manage to run in parallel.
|
||||||
//console.log('Closing connection with '+userId);
|
//console.log('Closing connection with '+userId);
|
||||||
@ -220,7 +220,7 @@ export class SimplePeer {
|
|||||||
// FIXME: I don't understand why "Closing connection with" message is displayed TWICE before "Nb users in peerConnectionArray"
|
// FIXME: I don't understand why "Closing connection with" message is displayed TWICE before "Nb users in peerConnectionArray"
|
||||||
// I do understand the method closeConnection is called twice, but I don't understand how they manage to run in parallel.
|
// I do understand the method closeConnection is called twice, but I don't understand how they manage to run in parallel.
|
||||||
//console.log('Closing connection with '+userId);
|
//console.log('Closing connection with '+userId);
|
||||||
peer.closeScreenSharingConnection();
|
peer.destroy();
|
||||||
this.PeerScreenSharingConnectionArray.delete(userId)
|
this.PeerScreenSharingConnectionArray.delete(userId)
|
||||||
//console.log('Nb users in peerConnectionArray '+this.PeerConnectionArray.size);
|
//console.log('Nb users in peerConnectionArray '+this.PeerConnectionArray.size);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -39,7 +39,7 @@ export class VideoPeer extends Peer {
|
|||||||
});*/
|
});*/
|
||||||
|
|
||||||
this.on('close', () => {
|
this.on('close', () => {
|
||||||
this.closeConnection();
|
this.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
@ -97,15 +97,15 @@ export class VideoPeer extends Peer {
|
|||||||
/**
|
/**
|
||||||
* This is triggered twice. Once by the server, and once by a remote client disconnecting
|
* This is triggered twice. Once by the server, and once by a remote client disconnecting
|
||||||
*/
|
*/
|
||||||
public closeConnection() {
|
public destroy(error?: Error): void {
|
||||||
try {
|
try {
|
||||||
mediaManager.removeActiveVideo(this.userId);
|
mediaManager.removeActiveVideo(this.userId);
|
||||||
// FIXME: I don't understand why "Closing connection with" message is displayed TWICE before "Nb users in peerConnectionArray"
|
// FIXME: I don't understand why "Closing connection with" message is displayed TWICE before "Nb users in peerConnectionArray"
|
||||||
// I do understand the method closeConnection is called twice, but I don't understand how they manage to run in parallel.
|
// I do understand the method closeConnection is called twice, but I don't understand how they manage to run in parallel.
|
||||||
//console.log('Closing connection with '+userId);
|
//console.log('Closing connection with '+userId);
|
||||||
this.destroy();
|
super.destroy(error);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("closeConnection", err)
|
console.error("VideoPeer::destroy", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user