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:
LoRd_MuldeR 2014-02-02 15:58:59 +01:00
parent d48e218b12
commit ad9e7e0d77
2 changed files with 18 additions and 19 deletions

View File

@ -252,6 +252,7 @@ void UpdateCheckThread::checkForUpdates(void)
// ----- Test Internet Connection ----- // // ----- Test Internet Connection ----- //
int connectionScore = 0; int connectionScore = 0;
int maxConnectTries = 2 * MIN_CONNSCORE;
log("Checking internet connection..."); log("Checking internet connection...");
setStatus(UpdateStatus_CheckingConnection); setStatus(UpdateStatus_CheckingConnection);
@ -276,28 +277,26 @@ void UpdateCheckThread::checkForUpdates(void)
} }
x264_seed_rand(); x264_seed_rand();
while(!hostList.isEmpty())
while(!(hostList.isEmpty() || (connectionScore >= MIN_CONNSCORE) || (--maxConnectTries < 0)))
{ {
QString currentHost = hostList.takeAt(x264_rand() % hostList.count()); 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); connectionScore++;
QString outFile = QString("%1/%2.htm").arg(x264_temp_directory(), x264_rand_str()); setProgress(qBound(1, connectionScore + 1, MIN_CONNSCORE + 1));
bool httpOk = false; x264_sleep(64);
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);
} }
if(httpOk)
{
connectionScore++;
setProgress(qBound(1, connectionScore + 1, MIN_CONNSCORE + 1));
x264_sleep(64);
}
QFile::remove(outFile);
} }
if(connectionScore < MIN_CONNSCORE) if(connectionScore < MIN_CONNSCORE)

View File

@ -26,7 +26,7 @@
#define VER_X264_MAJOR 2 #define VER_X264_MAJOR 2
#define VER_X264_MINOR 3 #define VER_X264_MINOR 3
#define VER_X264_PATCH 0 #define VER_X264_PATCH 0
#define VER_X264_BUILD 746 #define VER_X264_BUILD 750
#define VER_X264_MINIMUM_REV 2380 #define VER_X264_MINIMUM_REV 2380
#define VER_X264_CURRENT_API 142 #define VER_X264_CURRENT_API 142