Skip to content

Commit 0bf83a3

Browse files
committed
bug fix
1 parent 1622e27 commit 0bf83a3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/src/ua.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,8 @@ class UA extends EventManager {
316316
// If there are session wait a bit so CANCEL/BYE can be sent and their responses received.
317317
int num_sessions = _sessions.length;
318318

319+
_stopping = true;
320+
319321
// Run _terminate_ on every Session.
320322
_sessions.forEach((String? key, _) {
321323
if (_sessions.containsKey(key)) {
@@ -344,8 +346,6 @@ class UA extends EventManager {
344346
}
345347
});
346348

347-
_stopping = true;
348-
349349
// Run _close_ on every applicant.
350350
for (Applicant applicant in _applicants) {
351351
try {
@@ -548,6 +548,9 @@ class UA extends EventManager {
548548
* RTCSession destroyed.
549549
*/
550550
void destroyRTCSession(RTCSession session) {
551+
if (_stopping) {
552+
return;
553+
}
551554
_sessions.remove(session.id);
552555
}
553556

0 commit comments

Comments
 (0)