diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/windows/updaterwindow.cpp | 12 | ||||
-rw-r--r-- | src/net/download.cpp | 18 |
2 files changed, 18 insertions, 12 deletions
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 37bbabda3..842176793 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -533,16 +533,20 @@ void UpdaterWindow::download() mDownload = new Net::Download(this, "http://manaplus.org/update/" + mCurrentFile, &updateProgress, true, false); + mDownload->addMirror("http://www.manaplus.org/update/" + mCurrentFile); } else { mDownload = new Net::Download(this, std::string(mUpdateHost).append( "/").append(mCurrentFile), &updateProgress, false, false); - } - const std::vector<std::string> &mirrors = client->getMirrors(); - FOR_EACH (std::vector<std::string>::const_iterator, it, mirrors) - mDownload->addMirror(*it); + const std::vector<std::string> &mirrors = client->getMirrors(); + FOR_EACH (std::vector<std::string>::const_iterator, it, mirrors) + { + mDownload->addMirror(std::string(*it).append( + "/").append(mCurrentFile)); + } + } if (mStoreInMemory) { diff --git a/src/net/download.cpp b/src/net/download.cpp index 1c555f5ef..26a3cfe58 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -276,6 +276,7 @@ int Download::downloadThread(void *ptr) d->mUrl = d->mUrlQueue.front(); d->mUrlQueue.pop(); + logger->log_r("selected url: %s", d->mUrl.c_str()); while (attempts < 3 && !complete && !d->mOptions.cancel) { d->mUpdateFunction(d->mPtr, DOWNLOAD_STATUS_STARTING, 0, 0); @@ -347,14 +348,17 @@ int Download::downloadThread(void *ptr) break; case CURLE_COULDNT_CONNECT: default: - { - if (d->mError) - { - logger->log_r("curl error %d: %s host: %s", - res, d->mError, d->mUrl.c_str()); - } break; + } + + if (res) + { + if (d->mError) + { + logger->log_r("curl error %d: %s host: %s", + res, d->mError, d->mUrl.c_str()); } + break; } if (d->mOptions.cancel) @@ -462,8 +466,6 @@ int Download::downloadThread(void *ptr) if ((complete && attempts < 3) || d->mOptions.cancel) break; - - logger->log_r("switch to next mirror: %s", d->mFileName.c_str()); } d->mThread = nullptr; |