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
fun stop() = when (iface) {
null -> { } // stopped
"" -> {
WifiApManager.cancelLocalOnlyHotspotRequest()
reservation?.close() ?: stopService()
fun stop() {
when (iface) {
null -> return // stopped
"" -> WifiApManager.cancelLocalOnlyHotspotRequest()
}
else -> reservation!!.close()
reservation?.close() ?: stopService()
}
}