diff options
| author | Al12rs <gabriel.cortesi@outlook.com> | 2018-06-19 23:13:06 +0200 |
|---|---|---|
| committer | Al12rs <gabriel.cortesi@outlook.com> | 2018-06-19 23:13:06 +0200 |
| commit | b6aa12b323a81f4ac8e1bb76c2fea780a1698d97 (patch) | |
| tree | 10de108e1fca4842c31e40eb010f8e429e9eb5e1 /src/downloadmanager.cpp | |
| parent | 19d80cc23d298326526755a3d980e6a079123385 (diff) | |
Fix for downloads getting insta-completed if there isn't enough bandwidth for them to procede. Now they will instead remain in the download state and continue once the bandwidth is available.
There is much room for improvement here but for now I guess this will avoid MO simply stopping the download.
Diffstat (limited to 'src/downloadmanager.cpp')
| -rw-r--r-- | src/downloadmanager.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 0341152a..6ed93ec1 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -785,7 +785,13 @@ void DownloadManager::resumeDownloadInt(int index) return;
}
- if (info->isPausedState()) {
+ if (info->isPausedState() || info->m_State == STATE_PAUSING) {
+ if (info->m_State == STATE_PAUSING) {
+ if (info->m_Output.isOpen()) {
+ info->m_Output.write(info->m_Reply->readAll());
+ setState(info, STATE_PAUSED);
+ }
+ }
if ((info->m_Urls.size() == 0)
|| ((info->m_Urls.size() == 1) && (info->m_Urls[0].size() == 0))) {
emit showMessage(tr("No known download urls. Sorry, this download can't be resumed."));
@@ -1662,6 +1668,7 @@ void DownloadManager::downloadFinished(int index) } else if (info->m_State == STATE_PAUSING) {
if (info->m_Output.isOpen()) {
info->m_Output.write(info->m_Reply->readAll());
+ setState(info, STATE_PAUSED);
}
}
@@ -1673,7 +1680,7 @@ void DownloadManager::downloadFinished(int index) if (error)
emit showMessage(tr("We were unable to download the file due to errors after four retries. There may be an issue with the Nexus servers."));
emit update(-1);
- } else if (info->isPausedState()) {
+ } else if (info->isPausedState() || info->m_State == STATE_PAUSING) {
info->m_Output.close();
createMetaFile(info);
emit update(index);
|
