summaryrefslogtreecommitdiffhomepage
path: root/android/src
diff options
context:
space:
mode:
Diffstat (limited to 'android/src')
-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
+ )
}
}