mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 19:05:46 -05:00
[libcalamares] Ping only when accessibility is unknown
- Restores exact functionality of previous version (noted by Kevin Kofler) - Short-circuit ping if the URL is bad.
This commit is contained in:
parent
e065008631
commit
eae931f2ed
1 changed files with 10 additions and 5 deletions
|
@ -66,14 +66,14 @@ CalamaresUtils::Network::Manager::hasInternet()
|
||||||
bool
|
bool
|
||||||
CalamaresUtils::Network::Manager::checkHasInternet()
|
CalamaresUtils::Network::Manager::checkHasInternet()
|
||||||
{
|
{
|
||||||
bool b = d->m_nam->networkAccessible() == QNetworkAccessManager::Accessible;
|
bool hasInternet = d->m_nam->networkAccessible() == QNetworkAccessManager::Accessible;
|
||||||
|
|
||||||
if ( !b && d->m_hasInternetUrl.isValid() )
|
if ( !hasInternet && ( d->m_nam->networkAccessible() == QNetworkAccessManager::UnknownAccessibility ) )
|
||||||
{
|
{
|
||||||
b = synchronousPing( d->m_hasInternetUrl );
|
hasInternet = synchronousPing( d->m_hasInternetUrl );
|
||||||
}
|
}
|
||||||
d->m_hasInternet = b;
|
d->m_hasInternet = hasInternet;
|
||||||
return b;
|
return hasInternet;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -85,6 +85,11 @@ CalamaresUtils::Network::Manager::setCheckHasInternetUrl( const QUrl& url )
|
||||||
bool
|
bool
|
||||||
CalamaresUtils::Network::Manager::synchronousPing( const QUrl& url )
|
CalamaresUtils::Network::Manager::synchronousPing( const QUrl& url )
|
||||||
{
|
{
|
||||||
|
if ( !url.isValid() )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
QNetworkRequest req = QNetworkRequest( url );
|
QNetworkRequest req = QNetworkRequest( url );
|
||||||
QNetworkReply* reply = d->m_nam->get( req );
|
QNetworkReply* reply = d->m_nam->get( req );
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
|
|
Loading…
Add table
Reference in a new issue