Browse Source

squash: remove pending tasks from the queue before scheduling close

dev1
paweldomas 6 years ago
parent
commit
c0af82a215
2 changed files with 12 additions and 0 deletions
  1. 7
    0
      modules/util/AsyncQueue.js
  2. 5
    0
      modules/xmpp/JingleSessionPC.js

+ 7
- 0
modules/util/AsyncQueue.js View File

@@ -12,6 +12,13 @@ export default class AsyncQueue {
12 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 23
      * Internal task processing implementation which makes things work.
17 24
      */

+ 5
- 0
modules/xmpp/JingleSessionPC.js View File

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

Loading…
Cancel
Save