diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2021-03-26 14:21:30 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2021-03-29 14:22:55 +0000 |
| commit | f62238c646cb27299863ec7fb3c0ad06e1f59fe6 (patch) | |
| tree | f8afdff272444ed6f68449d606b10fcd2850cb5b /android/src/main | |
| parent | 0c5c78abd1f77c50f848cc761c39ad43eca6f03a (diff) | |
| download | mullvadvpn-f62238c646cb27299863ec7fb3c0ad06e1f59fe6.tar.xz mullvadvpn-f62238c646cb27299863ec7fb3c0ad06e1f59fe6.zip | |
Only verify WireGuard key if it's present
Diffstat (limited to 'android/src/main')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/KeyStatusListener.kt | 15 |
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 + ) } } |
