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-26 16:19:52 +0200 |
commit | f2d166a6a45b28052662e68fda4c0f6fe0d097fe (patch) | |
tree | ca10cb5ca0fe30b30d2a129437f5aed20ad92dae /ui/src/main | |
parent | d8838021785f769b28ac95dd5bca6f92533b0cde (diff) |
ui: add basic double update guard
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui/src/main')
-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() { |