Skip to content

Commit 50aea85

Browse files
authored
Properly clean up child jobs on ICE reconnect timeout (#870)
1 parent d0f626d commit 50aea85

2 files changed

Lines changed: 17 additions & 12 deletions

File tree

.changeset/metal-mirrors-arrive.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"client-sdk-android": patch
3+
---
4+
5+
Ensure child jobs are cleaned up on ICE reconnect timeout

livekit-android-sdk/src/main/java/io/livekit/android/room/RTCEngine.kt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2025 LiveKit, Inc.
2+
* Copyright 2023-2026 LiveKit, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -620,20 +620,20 @@ internal constructor(
620620
break
621621
}
622622

623-
// wait until publisher ICE connected
624-
var publisherWaitJob: Job? = null
625-
if (hasPublished) {
626-
publisherWaitJob = launch {
627-
publisherObserver.waitUntilConnected()
623+
withTimeoutOrNull(MAX_ICE_CONNECT_TIMEOUT_MS.toLong()) {
624+
// wait until publisher ICE connected
625+
var publisherWaitJob: Job? = null
626+
if (hasPublished) {
627+
publisherWaitJob = launch {
628+
publisherObserver.waitUntilConnected()
629+
}
628630
}
629-
}
630631

631-
// wait until subscriber ICE connected
632-
val subscriberWaitJob = launch {
633-
subscriberObserver.waitUntilConnected()
634-
}
632+
// wait until subscriber ICE connected
633+
val subscriberWaitJob = launch {
634+
subscriberObserver.waitUntilConnected()
635+
}
635636

636-
withTimeoutOrNull(MAX_ICE_CONNECT_TIMEOUT_MS.toLong()) {
637637
listOfNotNull(publisherWaitJob, subscriberWaitJob)
638638
.joinAll()
639639
}

0 commit comments

Comments
 (0)