diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2019-12-11 22:57:44 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-01-07 14:03:28 +0000 |
| commit | 00edefaeaf18fee66d5beff17ed36caaee3e24dc (patch) | |
| tree | 38856bb66645b884f31bd6b724b10f92b6a61f06 | |
| parent | 08d28fb44b2d14a1abcd708112b3ac7009acb546 (diff) | |
| download | mullvadvpn-00edefaeaf18fee66d5beff17ed36caaee3e24dc.tar.xz mullvadvpn-00edefaeaf18fee66d5beff17ed36caaee3e24dc.zip | |
Use synchronous daemon in `LocationInfoCache`
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/LocationInfoCache.kt | 4 | ||||
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/ui/ServiceConnection.kt | 3 |
2 files changed, 3 insertions, 4 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 a511156bf3..2ccde2594b 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/LocationInfoCache.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/LocationInfoCache.kt @@ -21,7 +21,7 @@ const val MAX_DELAY: Long = 30 * 60 * 1000 const val MAX_RETRIES: Int = 17 // ceil(log2(MAX_DELAY / DELAY_SCALE) + 1) class LocationInfoCache( - val daemon: Deferred<MullvadDaemon>, + val daemon: MullvadDaemon, val connectivityListener: Deferred<ConnectivityListener>, val relayListListener: RelayListListener ) { @@ -132,7 +132,7 @@ class LocationInfoCache( } private fun executeFetch() = GlobalScope.async(Dispatchers.Default) { - daemon.await().getCurrentLocation() + daemon.getCurrentLocation() } private suspend fun delayFetch(retryAttempt: Int) { diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/ServiceConnection.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/ServiceConnection.kt index cc799ed00f..5fc866b2d8 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/ServiceConnection.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/ServiceConnection.kt @@ -25,8 +25,7 @@ class ServiceConnection(private val service: ServiceInstance, val mainActivity: val settingsListener = SettingsListener(asyncDaemon) val accountCache = AccountCache(settingsListener, daemon) var relayListListener = RelayListListener(asyncDaemon, settingsListener) - val locationInfoCache = - LocationInfoCache(asyncDaemon, asyncConnectivityListener, relayListListener) + val locationInfoCache = LocationInfoCache(daemon, asyncConnectivityListener, relayListListener) val wwwAuthTokenRetriever = WwwAuthTokenRetriever(asyncDaemon) init { |
