summaryrefslogtreecommitdiffstats
path: root/logic/LegacyUpdate.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-09-02 00:25:40 +0200
committerPetr Mrázek <peterix@gmail.com>2013-09-02 00:25:40 +0200
commitf8e8414d544f1227e86099146bba903c9082d09e (patch)
treea0983c2a5a17feda4c2f813d32d0b98111463176 /logic/LegacyUpdate.cpp
parent78e278c1e33e39eb29a26a976b19ea6a8150bfff (diff)
downloadMultiMC-f8e8414d544f1227e86099146bba903c9082d09e.tar
MultiMC-f8e8414d544f1227e86099146bba903c9082d09e.tar.gz
MultiMC-f8e8414d544f1227e86099146bba903c9082d09e.tar.lz
MultiMC-f8e8414d544f1227e86099146bba903c9082d09e.tar.xz
MultiMC-f8e8414d544f1227e86099146bba903c9082d09e.zip
Speed up the downloads. Massively.
Diffstat (limited to 'logic/LegacyUpdate.cpp')
-rw-r--r--logic/LegacyUpdate.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/logic/LegacyUpdate.cpp b/logic/LegacyUpdate.cpp
index fa93ab8f..3d286373 100644
--- a/logic/LegacyUpdate.cpp
+++ b/logic/LegacyUpdate.cpp
@@ -52,7 +52,7 @@ void LegacyUpdate::lwjglStart()
QString url = version->url();
QUrl realUrl(url);
QString hostname = realUrl.host();
- auto &worker = NetWorker::spawn();
+ auto &worker = NetWorker::qnam();
QNetworkRequest req(realUrl);
req.setRawHeader("Host", hostname.toLatin1());
req.setHeader(QNetworkRequest::UserAgentHeader, "Wget/1.14 (linux-gnu)");
@@ -77,7 +77,7 @@ void LegacyUpdate::lwjglFinished(QNetworkReply* reply)
"\nSometimes you have to wait a bit if you download many LWJGL versions in a row. YMMV");
return;
}
- auto &worker = NetWorker::spawn();
+ auto &worker = NetWorker::qnam();
//Here i check if there is a cookie for me in the reply and extract it
QList<QNetworkCookie> cookies = qvariant_cast<QList<QNetworkCookie>>(reply->header(QNetworkRequest::SetCookieHeader));
if(cookies.count() != 0)
@@ -90,7 +90,6 @@ void LegacyUpdate::lwjglFinished(QNetworkReply* reply)
QVariant newLoc = reply->header(QNetworkRequest::LocationHeader);
if(newLoc.isValid())
{
- auto &worker = NetWorker::spawn();
QString redirectedTo = reply->header(QNetworkRequest::LocationHeader).toString();
QUrl realUrl(redirectedTo);
QString hostname = realUrl.host();
@@ -228,14 +227,11 @@ void LegacyUpdate::jarStart()
QString intended_version_id = inst->intendedVersionId();
urlstr += intended_version_id + "/" + intended_version_id + ".jar";
- auto dljob = DownloadJob::create(QUrl(urlstr), inst->defaultBaseJar());
-
- legacyDownloadJob.reset(new JobList());
- legacyDownloadJob->add(dljob);
+ legacyDownloadJob.reset(new DownloadJob(QUrl(urlstr), inst->defaultBaseJar()));
connect(legacyDownloadJob.data(), SIGNAL(finished()), SLOT(jarFinished()));
connect(legacyDownloadJob.data(), SIGNAL(failed()), SLOT(jarFailed()));
connect(legacyDownloadJob.data(), SIGNAL(progress(qint64,qint64)), SLOT(updateDownloadProgress(qint64,qint64)));
- download_queue.enqueue(legacyDownloadJob);
+ legacyDownloadJob->start();
}
void LegacyUpdate::jarFinished()