mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 21:15:33 +08:00
Ref T150, use network watchdog with web data services
* removed own checks and use watchdog * connect with readers to avoid redundant checks
This commit is contained in:
committed by
Mathew Sutcliffe
parent
46d2f2c048
commit
a4de52852d
@@ -177,12 +177,6 @@ namespace BlackCore
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CWebDataServices::canConnectSwiftDb(bool strict) const
|
||||
{
|
||||
if (!strict && this->hasConnectedSwiftDb()) { return true; }
|
||||
return CNetworkUtils::canConnect(sApp->getGlobalSetup().getDbHomePageUrl());
|
||||
}
|
||||
|
||||
void CWebDataServices::resetSignalFlags()
|
||||
{
|
||||
m_signalledEntities.clear();
|
||||
@@ -787,11 +781,6 @@ namespace BlackCore
|
||||
if (m_databaseWriter) { m_databaseWriter->gracefulShutdown(); }
|
||||
}
|
||||
|
||||
CUrl CWebDataServices::getDbReaderCurrentSharedDbDataUrl() const
|
||||
{
|
||||
return CDatabaseReader::getCurrentSharedDbDataUrl();
|
||||
}
|
||||
|
||||
CEntityFlags::Entity CWebDataServices::allDbEntitiesForUsedReaders() const
|
||||
{
|
||||
// obtain entities from real readers (means when reader is really used)
|
||||
@@ -834,7 +823,7 @@ namespace BlackCore
|
||||
// 1a. If any DB data, read the info objects upfront
|
||||
if (needsDbInfoObjects)
|
||||
{
|
||||
const bool databaseUp = CInfoDataReader::canPingSwiftServer();
|
||||
const bool databaseUp = sApp->isSwiftDbAccessible();
|
||||
if (!databaseUp) { dbReaderConfig.markAsDbDown(); }
|
||||
|
||||
if (anyDbEntities && readersNeeded.testFlag(CWebReaderFlags::WebReaderFlag::DbInfoDataReader))
|
||||
@@ -919,6 +908,8 @@ namespace BlackCore
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Cannot connect ICAO reader signals");
|
||||
c = connect(m_icaoDataReader, &CIcaoDataReader::dataRead, this, &CWebDataServices::dataRead);
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Cannot connect ICAO reader signals");
|
||||
c = connect(m_icaoDataReader, &CIcaoDataReader::swiftDbDataRead, this, &CWebDataServices::swiftDbDataRead);
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Cannot connect Model reader signals");
|
||||
m_icaoDataReader->start(QThread::LowPriority);
|
||||
}
|
||||
|
||||
@@ -930,6 +921,8 @@ namespace BlackCore
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Cannot connect Model reader signals");
|
||||
c = connect(m_modelDataReader, &CModelDataReader::dataRead, this, &CWebDataServices::dataRead);
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Cannot connect Model reader signals");
|
||||
c = connect(m_modelDataReader, &CModelDataReader::swiftDbDataRead, this, &CWebDataServices::swiftDbDataRead);
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Cannot connect Model reader signals");
|
||||
m_modelDataReader->start(QThread::LowPriority);
|
||||
}
|
||||
|
||||
@@ -941,6 +934,8 @@ namespace BlackCore
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Cannot connect Model reader signals");
|
||||
c = connect(m_airportDataReader, &CAirportDataReader::dataRead, this, &CWebDataServices::dataRead);
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Cannot connect Model reader signals");
|
||||
c = connect(m_airportDataReader, &CAirportDataReader::swiftDbDataRead, this, &CWebDataServices::swiftDbDataRead);
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Cannot connect Model reader signals");
|
||||
m_airportDataReader->start(QThread::LowPriority);
|
||||
}
|
||||
Q_UNUSED(c); // signal connect flag
|
||||
|
||||
@@ -119,9 +119,6 @@ namespace BlackCore
|
||||
//! Reader flags
|
||||
CWebReaderFlags::WebReader getReaderFlags() const { return m_readers; }
|
||||
|
||||
//! Currently used URL for shared DB data
|
||||
BlackMisc::Network::CUrl getDbReaderCurrentSharedDbDataUrl() const;
|
||||
|
||||
//! All DB entities for those readers used and not ignored
|
||||
BlackMisc::Network::CEntityFlags::Entity allDbEntitiesForUsedReaders() const;
|
||||
|
||||
@@ -404,9 +401,6 @@ namespace BlackCore
|
||||
//! Has already connect swift DB?
|
||||
bool hasConnectedSwiftDb() const;
|
||||
|
||||
//! Can connect swift DB?
|
||||
bool canConnectSwiftDb(bool strict = false) const;
|
||||
|
||||
//! Reset the flags what was already signaled
|
||||
void resetSignalFlags();
|
||||
|
||||
@@ -426,6 +420,9 @@ namespace BlackCore
|
||||
//! Combined read signal
|
||||
void dataRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState state, int number);
|
||||
|
||||
//! DB data read
|
||||
void swiftDbDataRead(bool success);
|
||||
|
||||
// simplified signals follow
|
||||
// 1) simple signature
|
||||
// 2) fired directly after read, no need to wait for other entities
|
||||
|
||||
Reference in New Issue
Block a user