Caller already has an active LocalOnlyHotspot request is now unexpected
This commit is contained in:
@@ -12,6 +12,7 @@ import be.mygod.vpnhotspot.net.wifi.WifiDoubleLock
|
|||||||
import be.mygod.vpnhotspot.util.StickyEvent1
|
import be.mygod.vpnhotspot.util.StickyEvent1
|
||||||
import be.mygod.vpnhotspot.util.broadcastReceiver
|
import be.mygod.vpnhotspot.util.broadcastReceiver
|
||||||
import be.mygod.vpnhotspot.widget.SmartSnackbar
|
import be.mygod.vpnhotspot.widget.SmartSnackbar
|
||||||
|
import timber.log.Timber
|
||||||
|
|
||||||
@RequiresApi(26)
|
@RequiresApi(26)
|
||||||
class LocalOnlyHotspotService : IpNeighbourMonitoringService() {
|
class LocalOnlyHotspotService : IpNeighbourMonitoringService() {
|
||||||
@@ -63,6 +64,7 @@ class LocalOnlyHotspotService : IpNeighbourMonitoringService() {
|
|||||||
override fun onBind(intent: Intent?) = binder
|
override fun onBind(intent: Intent?) = binder
|
||||||
|
|
||||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||||
|
if (binder.iface != null) return START_STICKY
|
||||||
binder.iface = ""
|
binder.iface = ""
|
||||||
// show invisible foreground notification on television to avoid being killed
|
// show invisible foreground notification on television to avoid being killed
|
||||||
if (app.uiMode.currentModeType == Configuration.UI_MODE_TYPE_TELEVISION) updateNotification()
|
if (app.uiMode.currentModeType == Configuration.UI_MODE_TYPE_TELEVISION) updateNotification()
|
||||||
@@ -106,9 +108,11 @@ class LocalOnlyHotspotService : IpNeighbourMonitoringService() {
|
|||||||
startFailure()
|
startFailure()
|
||||||
}
|
}
|
||||||
}, app.handler)
|
}, app.handler)
|
||||||
// assuming IllegalStateException will be thrown only if
|
} catch (e: IllegalStateException) {
|
||||||
// "Caller already has an active LocalOnlyHotspot request"
|
Timber.w(e)
|
||||||
} catch (_: IllegalStateException) { } catch (e: SecurityException) {
|
SmartSnackbar.make(e).show()
|
||||||
|
startFailure()
|
||||||
|
} catch (e: SecurityException) {
|
||||||
SmartSnackbar.make(e).show()
|
SmartSnackbar.make(e).show()
|
||||||
startFailure()
|
startFailure()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ class Routing(val downstream: String, ownerAddress: InterfaceAddress? = null) :
|
|||||||
fun revert() {
|
fun revert() {
|
||||||
stop()
|
stop()
|
||||||
TrafficRecorder.update() // record stats before exiting to prevent stats losing
|
TrafficRecorder.update() // record stats before exiting to prevent stats losing
|
||||||
clients.forEach { (_, subroute) -> subroute.close() }
|
clients.values.forEach { it.close() }
|
||||||
fallbackUpstream.subrouting?.transaction?.revert()
|
fallbackUpstream.subrouting?.transaction?.revert()
|
||||||
upstream.subrouting?.transaction?.revert()
|
upstream.subrouting?.transaction?.revert()
|
||||||
transaction.revert()
|
transaction.revert()
|
||||||
|
|||||||
Reference in New Issue
Block a user