Skip to content

Commit 1321754

Browse files
committedJul 23, 2022
Http server stop fix
1 parent 46acdf6 commit 1321754

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed
 

‎app/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ android {
1212
applicationId = "info.dvkr.screenstream"
1313
minSdkVersion(21)
1414
targetSdkVersion(32)
15-
versionCode = 30904
16-
versionName = "3.9.4"
15+
versionCode = 30905
16+
versionName = "3.9.5"
1717
resConfigs 'en', 'ru', 'pt-rBR', 'zh-rTW', 'fr-rFR', 'fa', 'it', 'pl', 'hi', 'de', 'sk', 'es', 'ar', 'ja', 'gl', 'ca', 'uk', 'nl'
1818

1919
vectorDrawables.useSupportLibrary = true

‎data/src/main/kotlin/info/dvkr/screenstream/data/state/AppStateMachineImpl.kt

+29-3
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,30 @@ import info.dvkr.screenstream.data.settings.Settings
2323
import info.dvkr.screenstream.data.state.helper.BroadcastHelper
2424
import info.dvkr.screenstream.data.state.helper.ConnectivityHelper
2525
import info.dvkr.screenstream.data.state.helper.NetworkHelper
26-
import kotlinx.coroutines.*
27-
import kotlinx.coroutines.flow.*
26+
import kotlinx.coroutines.CoroutineExceptionHandler
27+
import kotlinx.coroutines.CoroutineName
28+
import kotlinx.coroutines.CoroutineScope
29+
import kotlinx.coroutines.Dispatchers
30+
import kotlinx.coroutines.NonCancellable
31+
import kotlinx.coroutines.SupervisorJob
32+
import kotlinx.coroutines.cancel
33+
import kotlinx.coroutines.delay
34+
import kotlinx.coroutines.flow.Flow
35+
import kotlinx.coroutines.flow.MutableSharedFlow
36+
import kotlinx.coroutines.flow.MutableStateFlow
37+
import kotlinx.coroutines.flow.asStateFlow
38+
import kotlinx.coroutines.flow.catch
39+
import kotlinx.coroutines.flow.collect
40+
import kotlinx.coroutines.flow.distinctUntilChanged
41+
import kotlinx.coroutines.flow.drop
42+
import kotlinx.coroutines.flow.first
43+
import kotlinx.coroutines.flow.launchIn
44+
import kotlinx.coroutines.flow.onEach
45+
import kotlinx.coroutines.launch
46+
import kotlinx.coroutines.runBlocking
47+
import kotlinx.coroutines.withContext
48+
import kotlinx.coroutines.withTimeout
49+
import kotlinx.coroutines.withTimeoutOrNull
2850
import java.util.concurrent.LinkedBlockingDeque
2951

3052
class AppStateMachineImpl(
@@ -231,7 +253,11 @@ class AppStateMachineImpl(
231253
wakeLock = null
232254

233255
sendEvent(InternalEvent.Destroy)
234-
runBlocking(coroutineScope.coroutineContext) { withTimeout(1000) { httpServer.destroy().await() } }
256+
try {
257+
runBlocking(coroutineScope.coroutineContext) { withTimeout(1000) { httpServer.destroy().await() } }
258+
} catch (cause: Throwable) {
259+
XLog.e(getLog("destroy"), cause)
260+
}
235261
broadcastHelper.stopListening()
236262
connectivityHelper.stopListening()
237263
coroutineScope.cancel()

0 commit comments

Comments
 (0)
Failed to load comments.