Skip to content

Commit ac13957

Browse files
committed
ui: add basic double update guard
Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent 4ee525c commit ac13957

File tree

1 file changed

+5
-0
lines changed
  • ui/src/main/java/com/wireguard/android/updater

1 file changed

+5
-0
lines changed

ui/src/main/java/com/wireguard/android/updater/Updater.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,13 +312,18 @@ object Updater {
312312
session.close()
313313
}
314314

315+
private var updating = false
315316
private suspend fun downloadAndUpdateWrapErrors() {
317+
if (updating)
318+
return
319+
updating = true
316320
try {
317321
downloadAndUpdate()
318322
} catch (e: Throwable) {
319323
Log.e(TAG, "Update failure", e)
320324
emitProgress(Progress.Failure(e))
321325
}
326+
updating = false
322327
}
323328

324329
private class InstallReceiver : BroadcastReceiver() {

0 commit comments

Comments
 (0)