File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
livekit-android-sdk/src/main/java/io/livekit/android/room Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " client-sdk-android " : patch
3+ ---
4+
5+ Improve thread-safety and reconnection reliability for hasPublished flag.
Original file line number Diff line number Diff line change @@ -200,6 +200,7 @@ internal constructor(
200200 @Volatile
201201 private var isClosed = true
202202
203+ @Volatile
203204 private var hasPublished = false
204205
205206 private var coroutineScope = CloseableCoroutineScope (SupervisorJob () + ioDispatcher)
@@ -676,12 +677,14 @@ internal constructor(
676677 }
677678
678679 internal fun negotiatePublisher () {
680+ // Mark intent to publish before checking Signal state so reconnect() can
681+ // re-trigger negotiation even if the first attempt occurs before Signal connects.
682+ hasPublished = true
683+
679684 if (! client.isConnected) {
680685 return
681686 }
682687
683- hasPublished = true
684-
685688 coroutineScope.launch {
686689 if (negotiatePublisherMutex.tryLock()) {
687690 try {
You can’t perform that action at this time.
0 commit comments