diff --git a/src/blackcore/application.cpp b/src/blackcore/application.cpp index 3ef5e488e..2e594715c 100644 --- a/src/blackcore/application.cpp +++ b/src/blackcore/application.cpp @@ -574,17 +574,6 @@ namespace BlackCore return this->m_accessManager.networkAccessible() == QNetworkAccessManager::Accessible; } - bool CApplication::isNetworkConnected() const - { - static bool con = CNetworkUtils::hasConnectedInterface(); - return con; - } - - bool CApplication::isNetworkConnectedAndAccessible() const - { - return this->isNetworkConnected() && this->isNetworkAccessible(); - } - void CApplication::exit(int retcode) { if (instance()) diff --git a/src/blackcore/application.h b/src/blackcore/application.h index a4ac65d78..829da762a 100644 --- a/src/blackcore/application.h +++ b/src/blackcore/application.h @@ -154,12 +154,6 @@ namespace BlackCore //! Network accessible? bool isNetworkAccessible() const; - //! Network connected (at startup time) - bool isNetworkConnected() const; - - //! Network connected and also accessible - bool isNetworkConnectedAndAccessible() const; - //! Setup already synchronized bool isSetupAvailable() const; diff --git a/src/blackmisc/network/networkutils.cpp b/src/blackmisc/network/networkutils.cpp index f2f6f75bc..10892e963 100644 --- a/src/blackmisc/network/networkutils.cpp +++ b/src/blackmisc/network/networkutils.cpp @@ -48,30 +48,6 @@ namespace BlackMisc return 2000; } - bool CNetworkUtils::hasConnectedInterface(bool withDebugOutput) - { - // http://stackoverflow.com/questions/2475266/verfiying-the-network-connection-using-qt-4-4 - const QList interfaces = QNetworkInterface::allInterfaces(); - for (const QNetworkInterface &interface : interfaces) - { - // details of connection - if (withDebugOutput) qDebug() << "name:" << interface.name() << endl << "ip addresses:" << endl << "mac:" << interface.hardwareAddress() << endl; - if (interface.flags().testFlag(QNetworkInterface::IsUp) && !interface.flags().testFlag(QNetworkInterface::IsLoopBack)) - { - // this loop is important to check if there are addresses - for (const QNetworkAddressEntry &entry : interface.addressEntries()) - { - if (withDebugOutput) qDebug() << entry.ip().toString() << " / " << entry.netmask().toString() << endl; - - // we have an interface that is up, and has an ip address, therefore the link is present - // we will only enable this check on first positive, all later results are incorrect - return true; - } - } - } - return false; - } - bool CNetworkUtils::canPing(const QString &hostAddress) { if (hostAddress.isEmpty()) { return false; } @@ -110,12 +86,6 @@ namespace BlackMisc bool CNetworkUtils::canConnect(const QString &hostAddress, int port, QString &message, int timeoutMs) { - if (!CNetworkUtils::hasConnectedInterface(false)) - { - message = QObject::tr("No connected network interface", "BlackMisc"); - return false; - } - // KB: I have had an issue with QTcpSocket. It was stuck in HostLookupState and did // only recover after a reboot for no obvious reason. // Currently trying the ping alternative diff --git a/src/blackmisc/network/networkutils.h b/src/blackmisc/network/networkutils.h index 1c36b9aa8..3dca84c7e 100644 --- a/src/blackmisc/network/networkutils.h +++ b/src/blackmisc/network/networkutils.h @@ -50,10 +50,6 @@ namespace BlackMisc //! Default for timeout static int getTimeoutMs(); - //! Is a connected interface available? - //! \param withDebugOutput enables some debugging output - static bool hasConnectedInterface(bool withDebugOutput = false); - //! Can ping the address? //! \note uses OS ping static bool canPing(const QString &hostAddress);