Merge pull request #56 from ca1e/patch-1

解决停止WebService
pull/58/head
kunfei 5 years ago committed by GitHub
commit 5f8a3dc9ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      app/src/main/java/io/legado/app/service/WebService.kt

@ -48,6 +48,12 @@ class WebService : BaseService() {
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
isRun = false isRun = false
if (httpServer?.isAlive == true) {
httpServer?.stop()
}
if (webSocketServer?.isAlive == true) {
webSocketServer?.stop()
}
} }
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
@ -112,4 +118,4 @@ class WebService : BaseService() {
val notification = builder.build() val notification = builder.build()
startForeground(AppConst.notificationIdWeb, notification) startForeground(AppConst.notificationIdWeb, notification)
} }
} }

Loading…
Cancel
Save