fix: WebService 启动崩溃与关闭卡顿
This commit is contained in:
@@ -169,7 +169,9 @@ class WebService : BaseService() {
|
||||
postEvent(EventBus.WEB_SERVICE, hostAddress)
|
||||
FlowEventBus.post(EventBus.WEB_SERVICE, hostAddress)
|
||||
startForegroundNotification()
|
||||
} catch (e: IOException) {
|
||||
} catch (e: Exception) {
|
||||
ktorServer?.stop()
|
||||
ktorServer = null
|
||||
toastOnUi(e.localizedMessage ?: "")
|
||||
e.printOnDebug()
|
||||
stopSelf()
|
||||
|
||||
@@ -165,8 +165,8 @@ class KtorServer(private val port: Int) {
|
||||
}
|
||||
|
||||
fun stop() {
|
||||
server?.stop(1000, 1000)
|
||||
wsServer?.stop(1000, 1000)
|
||||
server?.stop(0, 0)
|
||||
wsServer?.stop(0, 0)
|
||||
}
|
||||
|
||||
private suspend fun PipelineContext<Unit, ApplicationCall>.handlePost(
|
||||
|
||||
Reference in New Issue
Block a user