diff --git a/android/lib/ipc/src/main/kotlin/net/mullvad/mullvadvpn/lib/ipc/DispatchingHandler.kt b/android/lib/ipc/src/main/kotlin/net/mullvad/mullvadvpn/lib/ipc/DispatchingHandler.kt index dd73f3c156c8..efaa1b78f802 100644 --- a/android/lib/ipc/src/main/kotlin/net/mullvad/mullvadvpn/lib/ipc/DispatchingHandler.kt +++ b/android/lib/ipc/src/main/kotlin/net/mullvad/mullvadvpn/lib/ipc/DispatchingHandler.kt @@ -15,7 +15,8 @@ class DispatchingHandler(looper: Looper, private val extractor: (Messag private val handlers = HashMap, (T) -> Unit>() private val lock = ReentrantReadWriteLock() - private val _parsedMessages = MutableSharedFlow(extraBufferCapacity = 1) + private val _parsedMessages = + MutableSharedFlow(extraBufferCapacity = MESSAGES_BUFFER_CAPACITY) val parsedMessages = _parsedMessages.asSharedFlow() @Deprecated("Use parsedMessages instead.") @@ -45,4 +46,8 @@ class DispatchingHandler(looper: Looper, private val extractor: (Messag removeCallbacksAndMessages(null) } + + companion object { + private const val MESSAGES_BUFFER_CAPACITY = 10 + } }