mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +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()
|
||||
{
|
||||
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();
|
||||
if (allConfigurations.isEmpty())
|
||||
{
|
||||
// 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_accessManager->setNetworkAccessible(QNetworkAccessManager::Accessible);
|
||||
@@ -1100,25 +1099,32 @@ namespace BlackCore
|
||||
}
|
||||
else
|
||||
{
|
||||
int active = 0;
|
||||
int valid = 0;
|
||||
int activeCount = 0;
|
||||
int validCount = 0;
|
||||
for (const QNetworkConfiguration &config : allConfigurations)
|
||||
{
|
||||
if (config.state() == QNetworkConfiguration::Active) { active++; }
|
||||
if (config.isValid()) { valid++; }
|
||||
if (config.state() == QNetworkConfiguration::Active) { activeCount++; m_noNwAccessPoint = false; }
|
||||
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 disable = active < 1; // only inactive
|
||||
if (disable) { CLogMessage(this).warning("Disabling network accessibility check in watchdog"); }
|
||||
m_networkWatchDog->disableNetworkAccessibilityCheck(disable);
|
||||
const bool disable = activeCount < 1; // only inactive
|
||||
if (disable && m_networkWatchDog->isNetworkAccessibilityCheckEnabled())
|
||||
{
|
||||
CLogMessage(this).warning("Disabling network accessibility check in watchdog");
|
||||
m_networkWatchDog->disableNetworkAccessibilityCheck(disable);
|
||||
}
|
||||
|
||||
// Is there default access point, use it
|
||||
const QNetworkConfiguration config = m_networkConfigManager->defaultConfiguration();
|
||||
if (!config.isValid() || (!canStartIAP && config.state() != QNetworkConfiguration::Active))
|
||||
{
|
||||
CLogMessage(this).warning("No network access point found for swift");
|
||||
if (!m_noNwAccessPoint)
|
||||
{
|
||||
m_noNwAccessPoint = true;
|
||||
CLogMessage(this).warning("No network access point found for swift");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -645,8 +645,9 @@ namespace BlackCore
|
||||
CCoreFacadeConfig m_coreFacadeConfig; //!< Core facade config if any
|
||||
CWebReaderFlags::WebReader m_webReadersUsed; //!< Readers to be used
|
||||
Db::CDatabaseReaderConfigList m_dbReaderConfig; //!< Load or used caching?
|
||||
bool m_useContexts = false; //!< use contexts
|
||||
bool m_useWebData = false; //!< use web data
|
||||
bool m_noNwAccessPoint = false; //!< no network access point?
|
||||
bool m_useContexts = false; //!< use contexts
|
||||
bool m_useWebData = false; //!< use web data
|
||||
bool m_signalStartup = true; //!< signal startup automatically
|
||||
bool m_devFlag = false; //!< dev. environment
|
||||
bool m_saveSettingsOnShutdown = true; //!< saving all settings on shutdown
|
||||
|
||||
@@ -130,6 +130,10 @@ namespace BlackCore
|
||||
//! \threadsafe
|
||||
bool isNetworkAccessibilityCheckDisabled() const { return m_disableNetworkCheck; }
|
||||
|
||||
//! Network check enabled?
|
||||
//! \threadsafe
|
||||
bool isNetworkAccessibilityCheckEnabled() const { return !this->isNetworkAccessibilityCheckDisabled(); }
|
||||
|
||||
//! URL referring to the DB
|
||||
//! \remark depends on BlackCore::Application::getGlobalSetup()
|
||||
static bool isDbUrl(const BlackMisc::Network::CUrl &url);
|
||||
|
||||
Reference in New Issue
Block a user