Merge pull request #1502 from asif-mahmud/calamares
[libcalamares] Internet accessibility checking done by synchronous ping method
This commit is contained in:
commit
c3903b6e88
@ -149,18 +149,23 @@ Manager::hasInternet()
|
|||||||
bool
|
bool
|
||||||
Manager::checkHasInternet()
|
Manager::checkHasInternet()
|
||||||
{
|
{
|
||||||
bool hasInternet = d->nam()->networkAccessible() == QNetworkAccessManager::Accessible;
|
|
||||||
|
|
||||||
if ( !hasInternet && ( d->nam()->networkAccessible() == QNetworkAccessManager::UnknownAccessibility ) )
|
d->m_hasInternet = synchronousPing( d->m_hasInternetUrl );
|
||||||
|
|
||||||
|
// For earlier Qt versions (< 5.15.0), set the accessibility flag to
|
||||||
|
// NotAccessible if synchronous ping has failed, so that any module
|
||||||
|
// using Qt's networkAccessible method to determine whether or not
|
||||||
|
// internet connection is actually avaialable won't get confused over
|
||||||
|
// virtualization technologies.
|
||||||
|
#if ( QT_VERSION < QT_VERSION_CHECK( 5, 15, 0 ) )
|
||||||
|
if ( !d->m_hasInternet )
|
||||||
{
|
{
|
||||||
hasInternet = synchronousPing( d->m_hasInternetUrl );
|
d->nam()->setNetworkAccessible( QNetworkAccessManager::NotAccessible );
|
||||||
}
|
}
|
||||||
if ( hasInternet != d->m_hasInternet )
|
#endif
|
||||||
{
|
|
||||||
d->m_hasInternet = hasInternet;
|
emit hasInternetChanged( d->m_hasInternet );
|
||||||
emit hasInternetChanged( hasInternet );
|
return d->m_hasInternet;
|
||||||
}
|
|
||||||
return hasInternet;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user