Only keep one self destruct timeout, ref #255

This commit is contained in:
Håvar Aambø Fosstveit
2020-05-06 13:50:29 +02:00
parent feac3f069d
commit 45a89b9f1a
+11 -1
View File
@@ -117,6 +117,8 @@ class Room extends EventEmitter
this._peers = {};
this._selfDestructTimeout = null;
// Array of mediasoup Router instances.
this._mediasoupRouters = mediasoupRouters;
@@ -146,6 +148,11 @@ class Room extends EventEmitter
this._closed = true;
if (this._selfDestructTimeout)
clearTimeout(this._selfDestructTimeout);
this._selfDestructTimeout = null;
this._chatHistory = null;
this._fileHistory = null;
@@ -411,7 +418,10 @@ class Room extends EventEmitter
{
logger.debug('selfDestructCountdown() started');
setTimeout(() =>
if (this._selfDestructTimeout)
clearTimeout(this._selfDestructTimeout);
this._selfDestructTimeout = setTimeout(() =>
{
if (this._closed)
return;