You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-29 16:43:09 +03:00
Fix checkTurnServers leak on logout
Remember to cancel the checkTurnServers callback when we stop the client.
This commit is contained in:
@@ -2543,6 +2543,7 @@ MatrixClient.prototype.stopClient = function() {
|
|||||||
if (this._crypto) {
|
if (this._crypto) {
|
||||||
global.clearInterval(this._uploadIntervalID);
|
global.clearInterval(this._uploadIntervalID);
|
||||||
}
|
}
|
||||||
|
global.clearTimeout(this._checkTurnServersTimeoutID);
|
||||||
};
|
};
|
||||||
|
|
||||||
function setupCallEventHandler(client) {
|
function setupCallEventHandler(client) {
|
||||||
@@ -2762,12 +2763,14 @@ function checkTurnServers(client) {
|
|||||||
};
|
};
|
||||||
client._turnServers = [servers];
|
client._turnServers = [servers];
|
||||||
// re-fetch when we're about to reach the TTL
|
// re-fetch when we're about to reach the TTL
|
||||||
|
client._checkTurnServersTimeoutID =
|
||||||
setTimeout(function() { checkTurnServers(client); },
|
setTimeout(function() { checkTurnServers(client); },
|
||||||
(res.ttl || (60 * 60)) * 1000 * 0.9
|
(res.ttl || (60 * 60)) * 1000 * 0.9
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
console.error("Failed to get TURN URIs");
|
console.error("Failed to get TURN URIs");
|
||||||
|
client._checkTurnServersTimeoutID =
|
||||||
setTimeout(function() { checkTurnServers(client); }, 60000);
|
setTimeout(function() { checkTurnServers(client); }, 60000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user