mirror of https://github.com/OpenVidu/openvidu.git
openvidu-browser: dispose remote Connection on connectionDestroyed event
parent
b2426149c6
commit
4aa1813383
|
@ -129,6 +129,8 @@ export class Connection {
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
sendIceCandidate(candidate: RTCIceCandidate): void {
|
sendIceCandidate(candidate: RTCIceCandidate): void {
|
||||||
|
|
||||||
|
if (!this.disposed) {
|
||||||
logger.debug((!!this.stream!.outboundStreamOpts ? 'Local' : 'Remote') + 'candidate for' + this.connectionId, candidate);
|
logger.debug((!!this.stream!.outboundStreamOpts ? 'Local' : 'Remote') + 'candidate for' + this.connectionId, candidate);
|
||||||
|
|
||||||
this.session.openvidu.sendRequest(
|
this.session.openvidu.sendRequest(
|
||||||
|
@ -154,6 +156,9 @@ export class Connection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
logger.warn(`Connection ${this.connectionId} disposed when trying to send an ICE candidate. ICE candidate not sent`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -198,7 +203,7 @@ export class Connection {
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
removeStream(streamId: string): void {
|
removeStream(): void {
|
||||||
delete this.stream;
|
delete this.stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,9 +211,7 @@ export class Connection {
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
dispose(): void {
|
dispose(): void {
|
||||||
if (!!this.stream) {
|
|
||||||
delete this.stream;
|
|
||||||
}
|
|
||||||
this.disposed = true;
|
this.disposed = true;
|
||||||
|
this.removeStream();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -845,6 +845,7 @@ export class Session extends EventDispatcher {
|
||||||
|
|
||||||
this.remoteStreamsCreated.delete(stream.streamId);
|
this.remoteStreamsCreated.delete(stream.streamId);
|
||||||
}
|
}
|
||||||
|
connection.dispose();
|
||||||
this.remoteConnections.delete(connection.connectionId);
|
this.remoteConnections.delete(connection.connectionId);
|
||||||
this.ee.emitEvent('connectionDestroyed', [
|
this.ee.emitEvent('connectionDestroyed', [
|
||||||
new ConnectionEvent(false, this, 'connectionDestroyed', connection, event.reason)
|
new ConnectionEvent(false, this, 'connectionDestroyed', connection, event.reason)
|
||||||
|
@ -912,7 +913,7 @@ export class Session extends EventDispatcher {
|
||||||
if (connection.stream != null) {
|
if (connection.stream != null) {
|
||||||
const streamId: string = connection.stream!.streamId;
|
const streamId: string = connection.stream!.streamId;
|
||||||
this.remoteStreamsCreated.delete(streamId);
|
this.remoteStreamsCreated.delete(streamId);
|
||||||
connection.removeStream(streamId);
|
connection.removeStream();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((openViduError) => {
|
.catch((openViduError) => {
|
||||||
|
|
Loading…
Reference in New Issue