瀏覽代碼

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

Loading…
取消
儲存