mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-08-04 09:41:28 +00:00
DownloadProgressTracker: Fix behaviour when download is done.
Currently progress() can be called after doneDownload() which should not happen. Also make sure that we call progress() with 100% progress before we call doneDownload() - this is in case any existing users have given up on downDownload() being called at the right time and instead use 100% progress as their signal that downloading is complete.
This commit is contained in:
committed by
Andreas Schildbach
parent
45e25167cd
commit
3403fc52c6
@@ -66,8 +66,13 @@ public class DownloadProgressTracker extends AbstractPeerDataEventListener {
|
||||
|
||||
if (blocksLeft == 0) {
|
||||
caughtUp = true;
|
||||
if (lastPercent != 100) {
|
||||
lastPercent = 100;
|
||||
progress(lastPercent, blocksLeft, new Date(block.getTimeSeconds() * 1000));
|
||||
}
|
||||
doneDownload();
|
||||
future.set(peer.getBestHeight());
|
||||
return;
|
||||
}
|
||||
|
||||
if (blocksLeft < 0 || originalBlocksLeft <= 0)
|
||||
|
Reference in New Issue
Block a user