Only keep one self destruct timeout, ref #255

auto_join_3.3
Håvar Aambø Fosstveit 2020-05-06 13:50:29 +02:00
parent feac3f069d
commit 45a89b9f1a
1 changed files with 11 additions and 1 deletions

View File

@ -117,6 +117,8 @@ class Room extends EventEmitter
this._peers = {}; this._peers = {};
this._selfDestructTimeout = null;
// Array of mediasoup Router instances. // Array of mediasoup Router instances.
this._mediasoupRouters = mediasoupRouters; this._mediasoupRouters = mediasoupRouters;
@ -146,6 +148,11 @@ class Room extends EventEmitter
this._closed = true; this._closed = true;
if (this._selfDestructTimeout)
clearTimeout(this._selfDestructTimeout);
this._selfDestructTimeout = null;
this._chatHistory = null; this._chatHistory = null;
this._fileHistory = null; this._fileHistory = null;
@ -411,7 +418,10 @@ class Room extends EventEmitter
{ {
logger.debug('selfDestructCountdown() started'); logger.debug('selfDestructCountdown() started');
setTimeout(() => if (this._selfDestructTimeout)
clearTimeout(this._selfDestructTimeout);
this._selfDestructTimeout = setTimeout(() =>
{ {
if (this._closed) if (this._closed)
return; return;