瀏覽代碼

squash: set peerconnection listeners to null on close

dev1
paweldomas 6 年之前
父節點
當前提交
1a58501ac8
共有 1 個檔案被更改,包括 6 行新增7 行删除
  1. 6
    7
      modules/xmpp/JingleSessionPC.js

+ 6
- 7
modules/xmpp/JingleSessionPC.js 查看文件

@@ -309,7 +309,7 @@ export default class JingleSessionPC extends JingleSession {
309 309
                     pcOptions);
310 310
 
311 311
         this.peerconnection.onicecandidate = ev => {
312
-            if (!ev || !this._assertNotEnded()) {
312
+            if (!ev) {
313 313
                 // There was an incomplete check for ev before which left
314 314
                 // the last line of the function unprotected from a potential
315 315
                 // throw of an exception. Consequently, it may be argued that
@@ -365,9 +365,6 @@ export default class JingleSessionPC extends JingleSession {
365 365
         // "closed" instead.
366 366
         // I suppose at some point this will be moved to onconnectionstatechange
367 367
         this.peerconnection.onsignalingstatechange = () => {
368
-            if (!this.peerconnection || !this._assertNotEnded()) {
369
-                return;
370
-            }
371 368
             if (this.peerconnection.signalingState === 'stable') {
372 369
                 this.wasstable = true;
373 370
             } else if (this.peerconnection.signalingState === 'closed'
@@ -383,9 +380,6 @@ export default class JingleSessionPC extends JingleSession {
383 380
          * the value of RTCPeerConnection.iceConnectionState changes.
384 381
          */
385 382
         this.peerconnection.oniceconnectionstatechange = () => {
386
-            if (!this.peerconnection || !this._assertNotEnded()) {
387
-                return;
388
-            }
389 383
             const now = window.performance.now();
390 384
 
391 385
             if (!this.isP2P) {
@@ -2208,6 +2202,11 @@ export default class JingleSessionPC extends JingleSession {
2208 2202
         this.state = JingleSessionState.ENDED;
2209 2203
         this.establishmentDuration = undefined;
2210 2204
 
2205
+        this.peerconnection.onicecandidate = null;
2206
+        this.peerconnection.oniceconnectionstatechange = null;
2207
+        this.peerconnection.onnegotiationneeded = null;
2208
+        this.peerconnection.onsignalingstatechange = null;
2209
+
2211 2210
         this.modificationQueue.push(finishCallback => {
2212 2211
             // The signaling layer will remove it's listeners
2213 2212
             this.signalingLayer.setChatRoom(null);

Loading…
取消
儲存