Skip to content

Commit 79a6d86

Browse files
committed
Add monitor destroy methods, that will get called when a connection is being destroyed to help ensure memory is garbage collectedg
1 parent 7d39a3a commit 79a6d86

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

couple.js

+6
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,12 @@ function couple(pc, targetId, signaller, opts) {
455455
mon('aborted');
456456
};
457457

458+
// Override destroy to clear the task queue as well
459+
mon.destroy = function() {
460+
mon.clear();
461+
q.clear();
462+
};
463+
458464
return mon;
459465
}
460466

monitor.js

+4
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ module.exports = function(pc, targetId, signaller, parentBus) {
9595

9696
monitor.checkState = checkState;
9797

98+
monitor.destroy = function() {
99+
monitor.clear();
100+
};
101+
98102
// if we haven't been provided a valid peer connection, abort
99103
if (! pc) {
100104
return monitor;

0 commit comments

Comments
 (0)