mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 19:05:31 +08:00
Reduced number of (unnecessary) network status messages
This commit is contained in:
committed by
Roland Winklmeier
parent
b6edb13da0
commit
09ab653cf9
@@ -1086,12 +1086,11 @@ namespace BlackCore
|
|||||||
void CApplication::onNetworkConfigurationsUpdateCompleted()
|
void CApplication::onNetworkConfigurationsUpdateCompleted()
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(m_networkConfigManager, Q_FUNC_INFO, "Need network config manager");
|
Q_ASSERT_X(m_networkConfigManager, Q_FUNC_INFO, "Need network config manager");
|
||||||
const QNetworkConfiguration config = m_networkConfigManager->defaultConfiguration();
|
|
||||||
const QList<QNetworkConfiguration> allConfigurations = m_networkConfigManager->allConfigurations();
|
const QList<QNetworkConfiguration> allConfigurations = m_networkConfigManager->allConfigurations();
|
||||||
if (allConfigurations.isEmpty())
|
if (allConfigurations.isEmpty())
|
||||||
{
|
{
|
||||||
// this is an odd situation we cannot handle, network check will be disabled
|
// this is an odd situation we cannot handle, network check will be disabled
|
||||||
if (!m_networkWatchDog->isNetworkAccessibilityCheckDisabled())
|
if (m_networkWatchDog->isNetworkAccessibilityCheckEnabled())
|
||||||
{
|
{
|
||||||
m_networkWatchDog->disableNetworkAccessibilityCheck(true);
|
m_networkWatchDog->disableNetworkAccessibilityCheck(true);
|
||||||
m_accessManager->setNetworkAccessible(QNetworkAccessManager::Accessible);
|
m_accessManager->setNetworkAccessible(QNetworkAccessManager::Accessible);
|
||||||
@@ -1100,28 +1099,35 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int active = 0;
|
int activeCount = 0;
|
||||||
int valid = 0;
|
int validCount = 0;
|
||||||
for (const QNetworkConfiguration &config : allConfigurations)
|
for (const QNetworkConfiguration &config : allConfigurations)
|
||||||
{
|
{
|
||||||
if (config.state() == QNetworkConfiguration::Active) { active++; }
|
if (config.state() == QNetworkConfiguration::Active) { activeCount++; m_noNwAccessPoint = false; }
|
||||||
if (config.isValid()) { valid++; }
|
if (config.isValid()) { validCount++; }
|
||||||
}
|
}
|
||||||
Q_UNUSED(valid);
|
Q_UNUSED(validCount);
|
||||||
|
|
||||||
// const bool isOnline = m_networkConfigManager->isOnline();
|
|
||||||
const bool canStartIAP = (m_networkConfigManager->capabilities() & QNetworkConfigurationManager::CanStartAndStopInterfaces);
|
const bool canStartIAP = (m_networkConfigManager->capabilities() & QNetworkConfigurationManager::CanStartAndStopInterfaces);
|
||||||
const bool disable = active < 1; // only inactive
|
const bool disable = activeCount < 1; // only inactive
|
||||||
if (disable) { CLogMessage(this).warning("Disabling network accessibility check in watchdog"); }
|
if (disable && m_networkWatchDog->isNetworkAccessibilityCheckEnabled())
|
||||||
|
{
|
||||||
|
CLogMessage(this).warning("Disabling network accessibility check in watchdog");
|
||||||
m_networkWatchDog->disableNetworkAccessibilityCheck(disable);
|
m_networkWatchDog->disableNetworkAccessibilityCheck(disable);
|
||||||
|
}
|
||||||
|
|
||||||
// Is there default access point, use it
|
// Is there default access point, use it
|
||||||
|
const QNetworkConfiguration config = m_networkConfigManager->defaultConfiguration();
|
||||||
if (!config.isValid() || (!canStartIAP && config.state() != QNetworkConfiguration::Active))
|
if (!config.isValid() || (!canStartIAP && config.state() != QNetworkConfiguration::Active))
|
||||||
{
|
{
|
||||||
|
if (!m_noNwAccessPoint)
|
||||||
|
{
|
||||||
|
m_noNwAccessPoint = true;
|
||||||
CLogMessage(this).warning("No network access point found for swift");
|
CLogMessage(this).warning("No network access point found for swift");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CApplication::initNetwork()
|
void CApplication::initNetwork()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -645,6 +645,7 @@ namespace BlackCore
|
|||||||
CCoreFacadeConfig m_coreFacadeConfig; //!< Core facade config if any
|
CCoreFacadeConfig m_coreFacadeConfig; //!< Core facade config if any
|
||||||
CWebReaderFlags::WebReader m_webReadersUsed; //!< Readers to be used
|
CWebReaderFlags::WebReader m_webReadersUsed; //!< Readers to be used
|
||||||
Db::CDatabaseReaderConfigList m_dbReaderConfig; //!< Load or used caching?
|
Db::CDatabaseReaderConfigList m_dbReaderConfig; //!< Load or used caching?
|
||||||
|
bool m_noNwAccessPoint = false; //!< no network access point?
|
||||||
bool m_useContexts = false; //!< use contexts
|
bool m_useContexts = false; //!< use contexts
|
||||||
bool m_useWebData = false; //!< use web data
|
bool m_useWebData = false; //!< use web data
|
||||||
bool m_signalStartup = true; //!< signal startup automatically
|
bool m_signalStartup = true; //!< signal startup automatically
|
||||||
|
|||||||
@@ -130,6 +130,10 @@ namespace BlackCore
|
|||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
bool isNetworkAccessibilityCheckDisabled() const { return m_disableNetworkCheck; }
|
bool isNetworkAccessibilityCheckDisabled() const { return m_disableNetworkCheck; }
|
||||||
|
|
||||||
|
//! Network check enabled?
|
||||||
|
//! \threadsafe
|
||||||
|
bool isNetworkAccessibilityCheckEnabled() const { return !this->isNetworkAccessibilityCheckDisabled(); }
|
||||||
|
|
||||||
//! URL referring to the DB
|
//! URL referring to the DB
|
||||||
//! \remark depends on BlackCore::Application::getGlobalSetup()
|
//! \remark depends on BlackCore::Application::getGlobalSetup()
|
||||||
static bool isDbUrl(const BlackMisc::Network::CUrl &url);
|
static bool isDbUrl(const BlackMisc::Network::CUrl &url);
|
||||||
|
|||||||
Reference in New Issue
Block a user