summaryrefslogtreecommitdiffhomepage
path: root/android
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2021-03-26 14:21:30 +0000
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2021-03-29 14:22:55 +0000
commitf62238c646cb27299863ec7fb3c0ad06e1f59fe6 (patch)
treef8afdff272444ed6f68449d606b10fcd2850cb5b /android
parent0c5c78abd1f77c50f848cc761c39ad43eca6f03a (diff)
downloadmullvadvpn-f62238c646cb27299863ec7fb3c0ad06e1f59fe6.tar.xz
mullvadvpn-f62238c646cb27299863ec7fb3c0ad06e1f59fe6.zip
Only verify WireGuard key if it's present
Diffstat (limited to 'android')
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/KeyStatusListener.kt15
1 files changed, 6 insertions, 9 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/KeyStatusListener.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/KeyStatusListener.kt
index f184c2ebaf..0efac1b21c 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/KeyStatusListener.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/KeyStatusListener.kt
@@ -41,16 +41,13 @@ class KeyStatusListener(val daemon: Intermittent<MullvadDaemon>) {
}
fun verifyKey() = GlobalScope.launch(Dispatchers.Default) {
- val verified = daemon.await().verifyWireguardKey()
// Only update verification status if the key is actually there
- when (val state = keyStatus) {
- is KeygenEvent.NewKey -> {
- keyStatus = KeygenEvent.NewKey(
- state.publicKey,
- verified,
- state.replacementFailure
- )
- }
+ (keyStatus as? KeygenEvent.NewKey)?.let { currentStatus ->
+ keyStatus = KeygenEvent.NewKey(
+ currentStatus.publicKey,
+ daemon.await().verifyWireguardKey(),
+ currentStatus.replacementFailure
+ )
}
}