diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-06-24 13:49:21 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-06-30 16:25:21 +0000 |
| commit | b746c6dc767d4aecb5aee7152a662cb6d2ffaf77 (patch) | |
| tree | f538e6786bcdecf2fa67ae3d8d7f81a344465827 | |
| parent | a07dbff5bf71930d715b17bb3473ef4c0dbfc338 (diff) | |
| download | mullvadvpn-b746c6dc767d4aecb5aee7152a662cb6d2ffaf77.tar.xz mullvadvpn-b746c6dc767d4aecb5aee7152a662cb6d2ffaf77.zip | |
Continue stopping the service after unbinding
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt index 14e62091cd..38d6a2e3eb 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt @@ -41,6 +41,7 @@ class MullvadVpnService : TalpidVpnService() { private val serviceNotifier = EventNotifier<ServiceInstance?>(null) private var isStopping = false + private var shouldStop = false private var loggedIn = false private var startDaemonJob: Job? = null @@ -121,6 +122,15 @@ class MullvadVpnService : TalpidVpnService() { } } + if (shouldStop) { + shouldStop = false + + if (isStopping) { + restart() + isStopping = false + } + } + return startResult } @@ -149,6 +159,10 @@ class MullvadVpnService : TalpidVpnService() { Log.d(TAG, "Closed all connections to service") isBound = false + if (shouldStop) { + stop() + } + return true } @@ -240,6 +254,7 @@ class MullvadVpnService : TalpidVpnService() { private fun stop() { Log.d(TAG, "Stopping service") isStopping = true + shouldStop = true stopDaemon() stopSelf() } |
