Bound the maximum number of hosts that will be tested during connectivity test, rather than testing *all* hosts. This avoids that the connectivity test will take VERY long to fail when the Internet connection is actually NOT working.
This commit is contained in:
parent
d48e218b12
commit
ad9e7e0d77
@ -252,6 +252,7 @@ void UpdateCheckThread::checkForUpdates(void)
|
||||
// ----- Test Internet Connection ----- //
|
||||
|
||||
int connectionScore = 0;
|
||||
int maxConnectTries = 2 * MIN_CONNSCORE;
|
||||
|
||||
log("Checking internet connection...");
|
||||
setStatus(UpdateStatus_CheckingConnection);
|
||||
@ -276,28 +277,26 @@ void UpdateCheckThread::checkForUpdates(void)
|
||||
}
|
||||
|
||||
x264_seed_rand();
|
||||
while(!hostList.isEmpty())
|
||||
|
||||
while(!(hostList.isEmpty() || (connectionScore >= MIN_CONNSCORE) || (--maxConnectTries < 0)))
|
||||
{
|
||||
QString currentHost = hostList.takeAt(x264_rand() % hostList.count());
|
||||
if(connectionScore < MIN_CONNSCORE)
|
||||
log("", "Testing host:", currentHost);
|
||||
QString outFile = QString("%1/%2.htm").arg(x264_temp_directory(), x264_rand_str());
|
||||
bool httpOk = false;
|
||||
if(getFile(currentHost, outFile, 0, &httpOk))
|
||||
{
|
||||
log("", "Testing host:", currentHost);
|
||||
QString outFile = QString("%1/%2.htm").arg(x264_temp_directory(), x264_rand_str());
|
||||
bool httpOk = false;
|
||||
if(getFile(currentHost, outFile, 0, &httpOk))
|
||||
{
|
||||
connectionScore++;
|
||||
setProgress(qBound(1, connectionScore + 1, MIN_CONNSCORE + 1));
|
||||
x264_sleep(64);
|
||||
}
|
||||
if(httpOk)
|
||||
{
|
||||
connectionScore++;
|
||||
setProgress(qBound(1, connectionScore + 1, MIN_CONNSCORE + 1));
|
||||
x264_sleep(64);
|
||||
}
|
||||
QFile::remove(outFile);
|
||||
connectionScore++;
|
||||
setProgress(qBound(1, connectionScore + 1, MIN_CONNSCORE + 1));
|
||||
x264_sleep(64);
|
||||
}
|
||||
if(httpOk)
|
||||
{
|
||||
connectionScore++;
|
||||
setProgress(qBound(1, connectionScore + 1, MIN_CONNSCORE + 1));
|
||||
x264_sleep(64);
|
||||
}
|
||||
QFile::remove(outFile);
|
||||
}
|
||||
|
||||
if(connectionScore < MIN_CONNSCORE)
|
||||
|
@ -26,7 +26,7 @@
|
||||
#define VER_X264_MAJOR 2
|
||||
#define VER_X264_MINOR 3
|
||||
#define VER_X264_PATCH 0
|
||||
#define VER_X264_BUILD 746
|
||||
#define VER_X264_BUILD 750
|
||||
|
||||
#define VER_X264_MINIMUM_REV 2380
|
||||
#define VER_X264_CURRENT_API 142
|
||||
|
Loading…
Reference in New Issue
Block a user