ui: add basic double update guard
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
d883802178
commit
f2d166a6a4
@ -312,13 +312,18 @@ object Updater {
|
|||||||
session.close()
|
session.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var updating = false
|
||||||
private suspend fun downloadAndUpdateWrapErrors() {
|
private suspend fun downloadAndUpdateWrapErrors() {
|
||||||
|
if (updating)
|
||||||
|
return
|
||||||
|
updating = true
|
||||||
try {
|
try {
|
||||||
downloadAndUpdate()
|
downloadAndUpdate()
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
Log.e(TAG, "Update failure", e)
|
Log.e(TAG, "Update failure", e)
|
||||||
emitProgress(Progress.Failure(e))
|
emitProgress(Progress.Failure(e))
|
||||||
}
|
}
|
||||||
|
updating = false
|
||||||
}
|
}
|
||||||
|
|
||||||
private class InstallReceiver : BroadcastReceiver() {
|
private class InstallReceiver : BroadcastReceiver() {
|
||||||
|
Loading…
Reference in New Issue
Block a user