diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2023-05-15 18:22:12 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2023-05-15 18:22:12 +0200 |
commit | ac139570c7212a8f0b1913037cfc6c0db5021ae6 (patch) | |
tree | 3b0cfe416be9b3945f7be0a6ec63651d10fde8f9 /ui/src/main/java | |
parent | 4ee525c37e6f3dbc62b60ac2c68d30d24989b9ad (diff) |
ui: add basic double update guard
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui/src/main/java')
-rw-r--r-- | ui/src/main/java/com/wireguard/android/updater/Updater.kt | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ui/src/main/java/com/wireguard/android/updater/Updater.kt b/ui/src/main/java/com/wireguard/android/updater/Updater.kt index f652ae2b..dbdbacfe 100644 --- a/ui/src/main/java/com/wireguard/android/updater/Updater.kt +++ b/ui/src/main/java/com/wireguard/android/updater/Updater.kt @@ -312,13 +312,18 @@ object Updater { session.close() } + private var updating = false private suspend fun downloadAndUpdateWrapErrors() { + if (updating) + return + updating = true try { downloadAndUpdate() } catch (e: Throwable) { Log.e(TAG, "Update failure", e) emitProgress(Progress.Failure(e)) } + updating = false } private class InstallReceiver : BroadcastReceiver() { |