mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 02:35:33 +08:00
Allow a forced update of the setup reader
When the network is down it can happen the bootstrap file request is not yet timed out but we use our own time out. In that case we check the cached data upfront by faking a failed web read.
This commit is contained in:
@@ -417,10 +417,21 @@ namespace BlackCore
|
||||
});
|
||||
|
||||
// setup handling completed with success or failure, or we run into time out
|
||||
if (m_setupReader->isSetupAvailable()) { return CStatusMessage(this).info("Setup available"); }
|
||||
CStatusMessageList msgs;
|
||||
bool forced = false;
|
||||
if (!m_setupReader->isSetupAvailable())
|
||||
{
|
||||
forced = true;
|
||||
m_setupReader->forceAvailabilityUpdate(); // maybe web reading still hanging
|
||||
}
|
||||
if (m_setupReader->isSetupAvailable())
|
||||
{
|
||||
msgs.push_back(CStatusMessage(this).info(forced ? "Setup available after forcing (so likely web read still pending)" : "Setup available"));
|
||||
return msgs;
|
||||
}
|
||||
|
||||
// getting here can means no "real" read success, and NO available cache
|
||||
CStatusMessageList msgs(CStatusMessage(this).error("Setup not available, setup reading failed or timed out."));
|
||||
msgs.push_back(CStatusMessage(this).error("Setup not available, setup reading failed or timed out."));
|
||||
if (m_setupReader->getLastSetupReadErrorMessages().hasErrorMessages())
|
||||
{
|
||||
msgs.push_back(m_setupReader->getLastSetupReadErrorMessages());
|
||||
|
||||
@@ -654,10 +654,10 @@ namespace BlackCore
|
||||
//! Write meta information into the application directory so other swift versions can display them
|
||||
void tagApplicationDataDirectory();
|
||||
|
||||
CInputManager *m_inputManager = nullptr; //!< Input devices and hotkeys
|
||||
QNetworkConfigurationManager *m_networkConfigManager = nullptr; //!< configuration
|
||||
QNetworkAccessManager *m_accessManager = nullptr; //!< single network access manager
|
||||
Db::CNetworkWatchdog *m_networkWatchDog = nullptr; //!< checking DB/internet access
|
||||
CInputManager *m_inputManager = nullptr; //!< Input devices and hotkeys
|
||||
QNetworkConfigurationManager *m_networkConfigManager = nullptr; //!< configuration
|
||||
QNetworkAccessManager *m_accessManager = nullptr; //!< single network access manager
|
||||
Db::CNetworkWatchdog *m_networkWatchDog = nullptr; //!< checking DB/internet access
|
||||
BlackMisc::CApplicationInfo m_applicationInfo; //!< Application if specified
|
||||
QScopedPointer<CCoreFacade> m_coreFacade; //!< core facade if any
|
||||
QScopedPointer<CSetupReader> m_setupReader; //!< setup reader
|
||||
@@ -670,12 +670,12 @@ namespace BlackCore
|
||||
CWebReaderFlags::WebReader m_webReadersUsed; //!< Readers to be used
|
||||
Db::CDatabaseReaderConfigList m_dbReaderConfig; //!< Load or used caching?
|
||||
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_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
|
||||
bool m_localSettingsLoaded = false; //!< local settings loaded?
|
||||
bool m_localSettingsLoaded = false; //!< local settings loaded?
|
||||
|
||||
// -------------- crashpad -----------------
|
||||
//! Init the crash handler
|
||||
|
||||
@@ -308,7 +308,7 @@ namespace BlackCore
|
||||
mutable QReadWriteLock m_statusLock; //!< Lock
|
||||
QNetworkReply::NetworkError m_1stReplyStatus = QNetworkReply::UnknownServerError; //!< Successful connection?
|
||||
QMap<BlackMisc::Network::CEntityFlags::Entity, HeaderResponse> m_sharedFileResponses; //!< file responses of the shared files
|
||||
BlackMisc::CStatusMessage::StatusSeverity m_severityNoWorkingUrl = BlackMisc::CStatusMessage::SeverityError; //!< severity of message if there is no working URL
|
||||
BlackMisc::CStatusMessage::StatusSeverity m_severityNoWorkingUrl = BlackMisc::CStatusMessage::SeverityWarning; //!< severity of message if there is no working URL
|
||||
|
||||
//! Constructor
|
||||
CDatabaseReader(QObject *owner, const CDatabaseReaderConfigList &config, const QString &name);
|
||||
|
||||
@@ -202,6 +202,11 @@ namespace BlackCore
|
||||
m_shutdown = true;
|
||||
}
|
||||
|
||||
void CSetupReader::forceAvailabilityUpdate()
|
||||
{
|
||||
this->manageSetupAvailability(false, false); // fake a failed web read
|
||||
}
|
||||
|
||||
void CSetupReader::readSetup()
|
||||
{
|
||||
const CStatusMessageList msgs(this->triggerReadSetup());
|
||||
|
||||
@@ -149,6 +149,10 @@ namespace BlackCore
|
||||
//! \threadsafe
|
||||
bool isSetupAvailable() const { return m_setupAvailable; }
|
||||
|
||||
//! Force an availability update
|
||||
//! \remark check for cached setup if the read check never got triggered
|
||||
void forceAvailabilityUpdate();
|
||||
|
||||
//! Version info available?
|
||||
//! \threadsafe
|
||||
bool isUpdateInfoAvailable() const { return m_updateInfoAvailable; }
|
||||
|
||||
Reference in New Issue
Block a user