Fix race in LOHS

This commit is contained in:
Mygod
2019-10-25 05:12:38 +08:00
parent 2504be45cf
commit 59036ca80d

View File

@@ -37,13 +37,12 @@ class LocalOnlyHotspotService : IpNeighbourMonitoringService(), CoroutineScope {
val configuration get() = reservation?.wifiConfiguration val configuration get() = reservation?.wifiConfiguration
fun stop() = when (iface) { fun stop() {
null -> { } // stopped when (iface) {
"" -> { null -> return // stopped
WifiApManager.cancelLocalOnlyHotspotRequest() "" -> WifiApManager.cancelLocalOnlyHotspotRequest()
reservation?.close() ?: stopService()
} }
else -> reservation!!.close() reservation?.close() ?: stopService()
} }
} }