diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-03-27 01:54:49 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-03-27 17:28:47 +0000 |
| commit | 2c2d9d720bba0d45277df4fc7519d4164f934c56 (patch) | |
| tree | ddd0275a138a8763c720223a8b445ad259e4ac0c /android | |
| parent | 16511e76d2e4b415532b095a54d12cb3f31eb268 (diff) | |
| download | mullvadvpn-2c2d9d720bba0d45277df4fc7519d4164f934c56.tar.xz mullvadvpn-2c2d9d720bba0d45277df4fc7519d4164f934c56.zip | |
Make sure location is updated atomically
Diffstat (limited to 'android')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/service/LocationInfoCache.kt | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/LocationInfoCache.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/LocationInfoCache.kt index 54114bc464..6d6c1e6359 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/LocationInfoCache.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/LocationInfoCache.kt @@ -153,11 +153,13 @@ class LocationInfoCache( newLocation = executeFetch().await() } - if (newLocation != null && fetchId == fetchIdCounter) { - location = newLocation + synchronized(this@LocationInfoCache) { + if (newLocation != null && fetchId == fetchIdCounter) { + location = newLocation - if (isRealLocation) { - lastKnownRealLocation = newLocation + if (isRealLocation) { + lastKnownRealLocation = newLocation + } } } } |
