//////////////////////////////////////////////////////////////////////////////////
#include <MUtils/UpdateChecker.h>
+#include <MUtils/Global.h>
#include <QStringList>
#include <QFile>
m_success = false;
m_updateInfo->resetInfo();
+ seed_rand();
setProgress(0);
// ----- Test Internet Connection ----- //
hostList << QString::fromLatin1(known_hosts[i]);
}
- lamexp_seed_rand();
-
while(!(hostList.isEmpty() || (connectionScore >= MIN_CONNSCORE) || (maxConnectTries < 1)))
{
- switch(tryContactHost(hostList.takeAt(lamexp_rand() % hostList.count())))
+ switch(tryContactHost(hostList.takeAt(next_rand32() % hostList.count())))
{
case 01: connectionScore += 1; break;
case 02: connectionScore += 2; break;
default: maxConnectTries -= 1; break;
}
setProgress(qBound(1, connectionScore + 1, MIN_CONNSCORE + 1));
- lamexp_sleep(64);
+ msleep(64);
}
if(connectionScore < MIN_CONNSCORE)
mirrorList << QString::fromLatin1(update_mirrors_prim[index]);
}
- lamexp_seed_rand();
if(const int len = mirrorList.count())
{
const int rounds = len * 1097;
for(int i = 0; i < rounds; i++)
{
- mirrorList.swap(i % len, lamexp_rand() % len);
+ mirrorList.swap(i % len, next_rand32() % len);
}
}
}
else
{
- lamexp_sleep(64);
+ msleep(64);
}
}
QString currentHost = hostList.takeFirst();
qDebug("Testing: %s", currentHost.toLatin1().constData());
log("", "Testing:", currentHost, "");
- QString outFile = QString("%1/%2.htm").arg(lamexp_temp_folder2(), lamexp_rand_str());
+ QString outFile = QString("%1/%2.htm").arg(temp_folder(), rand_str());
bool httpOk = false;
if(!getFile(currentHost, outFile, 0, &httpOk))
{
int UpdateChecker::tryContactHost(const QString &url)
{
int result = -1; bool httpOkay = false;
- const QString outFile = QString("%1/%2.htm").arg(lamexp_temp_folder2(), lamexp_rand_str());
+ const QString outFile = QString("%1/%2.htm").arg(temp_folder(), rand_str());
log("", "Testing host:", url);
if(getFile(url, outFile, 0, &httpOkay))
bool success = false;
log("", "Trying mirror:", url);
- const QString randPart = lamexp_rand_str();
- const QString outFileVers = QString("%1/%2.ver").arg(lamexp_temp_folder2(), randPart);
- const QString outFileSign = QString("%1/%2.sig").arg(lamexp_temp_folder2(), randPart);
+ const QString randPart = rand_str();
+ const QString outFileVers = QString("%1/%2.ver").arg(temp_folder(), randPart);
+ const QString outFileSign = QString("%1/%2.sig").arg(temp_folder(), randPart);
if(getUpdateInfo(url, outFileVers, outFileSign))
{
}
QProcess process;
- lamexp_init_process(process, output.absolutePath());
+ init_process(process, output.absolutePath());
QStringList args;
args << "-T" << "15" << "--no-cache" << "--no-dns-cache" << QString().sprintf("--max-redirect=%u", maxRedir);
}
QProcess process;
- lamexp_init_process(process, QFileInfo(file).absolutePath());
+ init_process(process, QFileInfo(file).absolutePath());
QEventLoop loop;
connect(&process, SIGNAL(error(QProcess::ProcessError)), &loop, SLOT(quit()));
log("WARNING: Version info timestamp is missing!");
return false;
}
- else if(updateInfoDate.addMonths(VERSION_INFO_EXPIRES_MONTHS) < lamexp_current_date_safe())
+ else if(updateInfoDate.addMonths(VERSION_INFO_EXPIRES_MONTHS) < current_date_safe())
{
updateInfo->resetInfo();
log(QString::fromLatin1("WARNING: This version info has expired at %1!").arg(updateInfoDate.addMonths(VERSION_INFO_EXPIRES_MONTHS).toString(Qt::ISODate)));
return false;
}
- else if(lamexp_current_date_safe() < updateInfoDate)
+ else if(current_date_safe() < updateInfoDate)
{
log("Version info is from the future, take care!");
qWarning("Version info is from the future, take care!");