Ver código fonte

squash: remove pending tasks from the queue before scheduling close

dev1
paweldomas 6 anos atrás
pai
commit
c0af82a215
2 arquivos alterados com 12 adições e 0 exclusões
  1. 7
    0
      modules/util/AsyncQueue.js
  2. 5
    0
      modules/xmpp/JingleSessionPC.js

+ 7
- 0
modules/util/AsyncQueue.js Ver arquivo

12
         this._stopped = false;
12
         this._stopped = false;
13
     }
13
     }
14
 
14
 
15
+    /**
16
+     * Removes any pending tasks from the queue.
17
+     */
18
+    clear() {
19
+        this._queue.kill();
20
+    }
21
+
15
     /**
22
     /**
16
      * Internal task processing implementation which makes things work.
23
      * Internal task processing implementation which makes things work.
17
      */
24
      */

+ 5
- 0
modules/xmpp/JingleSessionPC.js Ver arquivo

2207
         this.peerconnection.onnegotiationneeded = null;
2207
         this.peerconnection.onnegotiationneeded = null;
2208
         this.peerconnection.onsignalingstatechange = null;
2208
         this.peerconnection.onsignalingstatechange = null;
2209
 
2209
 
2210
+        // Remove any pending tasks from the queue
2211
+        this.modificationQueue.clear();
2212
+
2210
         this.modificationQueue.push(finishCallback => {
2213
         this.modificationQueue.push(finishCallback => {
2211
             // The signaling layer will remove it's listeners
2214
             // The signaling layer will remove it's listeners
2212
             this.signalingLayer.setChatRoom(null);
2215
             this.signalingLayer.setChatRoom(null);
2215
             this.peerconnection && this.peerconnection.close();
2218
             this.peerconnection && this.peerconnection.close();
2216
             finishCallback();
2219
             finishCallback();
2217
         });
2220
         });
2221
+
2222
+        // No more tasks can go in after the close task
2218
         this.modificationQueue.shutdown();
2223
         this.modificationQueue.shutdown();
2219
     }
2224
     }
2220
 
2225
 

Carregando…
Cancelar
Salvar