summaryrefslogtreecommitdiffhomepage
path: root/android/src
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2019-07-23 19:36:57 +0000
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2019-07-24 12:42:43 +0000
commit4fb039533c75feabee9b36a6473aaeb0a9e79c44 (patch)
treea02101cd9f88f3d9f4ca7a761c3b2b3968b11e74 /android/src
parent557a8506db7ce9105ca7201d4263356ad13c6125 (diff)
downloadmullvadvpn-4fb039533c75feabee9b36a6473aaeb0a9e79c44.tar.xz
mullvadvpn-4fb039533c75feabee9b36a6473aaeb0a9e79c44.zip
Handle after disconnect in `LocationInfoCache`
Diffstat (limited to 'android/src')
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/LocationInfoCache.kt9
1 files changed, 8 insertions, 1 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/LocationInfoCache.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/LocationInfoCache.kt
index 569f008729..74745118d3 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/LocationInfoCache.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/LocationInfoCache.kt
@@ -7,6 +7,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.Job
+import net.mullvad.mullvadvpn.model.ActionAfterDisconnect
import net.mullvad.mullvadvpn.model.GeoIpLocation
import net.mullvad.mullvadvpn.model.TunnelState
import net.mullvad.mullvadvpn.MullvadDaemon
@@ -38,7 +39,13 @@ class LocationInfoCache(val daemon: Deferred<MullvadDaemon>) {
location = value.location
fetchLocation()
}
- is TunnelState.Disconnecting -> location = lastKnownRealLocation
+ is TunnelState.Disconnecting -> {
+ when (value.actionAfterDisconnect) {
+ is ActionAfterDisconnect.Nothing -> location = lastKnownRealLocation
+ is ActionAfterDisconnect.Block -> location = null
+ is ActionAfterDisconnect.Reconnect -> {} // Leave location unchanged
+ }
+ }
is TunnelState.Blocked -> location = null
}
}