mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 12:55:31 +08:00
refactor: Remove watchdog command
This command adds some complexity as it allows to disable a worker from the outside. This is currently not required.
This commit is contained in:
@@ -313,13 +313,6 @@ namespace swift::core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAirspaceMonitor::enableAnalyzer(bool enable)
|
|
||||||
{
|
|
||||||
if (!this->analyzer()) { return false; }
|
|
||||||
this->analyzer()->setEnabled(enable);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAirspaceMonitor::testCreateDummyOnlineAtcStations(int number)
|
void CAirspaceMonitor::testCreateDummyOnlineAtcStations(int number)
|
||||||
{
|
{
|
||||||
if (number < 1) { return; }
|
if (number < 1) { return; }
|
||||||
@@ -413,11 +406,7 @@ namespace swift::core
|
|||||||
m_foundInElevationsOnGnd = 0;
|
m_foundInElevationsOnGnd = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAirspaceMonitor::gracefulShutdown()
|
void CAirspaceMonitor::gracefulShutdown() { QObject::disconnect(this); }
|
||||||
{
|
|
||||||
if (m_analyzer) { m_analyzer->setEnabled(false); }
|
|
||||||
QObject::disconnect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
int CAirspaceMonitor::reInitializeAllAircraft()
|
int CAirspaceMonitor::reInitializeAllAircraft()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -120,9 +120,6 @@ namespace swift::core
|
|||||||
//! Analyzer
|
//! Analyzer
|
||||||
CAirspaceAnalyzer *analyzer() const { return m_analyzer; }
|
CAirspaceAnalyzer *analyzer() const { return m_analyzer; }
|
||||||
|
|
||||||
//! \copydoc CAirspaceAnalyzer::setEnabled
|
|
||||||
bool enableAnalyzer(bool enable);
|
|
||||||
|
|
||||||
//! Gracefully shut down, e.g. for thread safety
|
//! Gracefully shut down, e.g. for thread safety
|
||||||
void gracefulShutdown();
|
void gracefulShutdown();
|
||||||
|
|
||||||
|
|||||||
@@ -386,8 +386,8 @@ namespace swift::core::context
|
|||||||
if (commandLine.isEmpty()) { return false; }
|
if (commandLine.isEmpty()) { return false; }
|
||||||
|
|
||||||
static const QStringList cmds({ ".msg", ".m", ".chat", ".altos", ".altoffset", ".addtimeos", ".addtimeoffset",
|
static const QStringList cmds({ ".msg", ".m", ".chat", ".altos", ".altoffset", ".addtimeos", ".addtimeoffset",
|
||||||
".wallop", ".watchdog", ".reinit", ".reinitialize", ".enable", ".disable",
|
".wallop", ".reinit", ".reinitialize", ".enable", ".disable", ".ignore",
|
||||||
".ignore", ".unignore", ".fsd" });
|
".unignore", ".fsd" });
|
||||||
CSimpleCommandParser parser(cmds);
|
CSimpleCommandParser parser(cmds);
|
||||||
parser.parse(commandLine);
|
parser.parse(commandLine);
|
||||||
if (!parser.isKnownCommand()) { return false; }
|
if (!parser.isKnownCommand()) { return false; }
|
||||||
@@ -526,15 +526,6 @@ namespace swift::core::context
|
|||||||
}
|
}
|
||||||
else { CLogMessage(this).info(u"Reset add. time offset"); }
|
else { CLogMessage(this).info(u"Reset add. time offset"); }
|
||||||
}
|
}
|
||||||
else if (parser.matchesCommand(".watchdog"))
|
|
||||||
{
|
|
||||||
if (!m_airspace) { return false; }
|
|
||||||
if (parser.countParts() < 2) { return false; }
|
|
||||||
|
|
||||||
const bool watchdog = parser.toBool(1, true);
|
|
||||||
m_airspace->enableAnalyzer(watchdog);
|
|
||||||
CLogMessage(this).info(u"Enabled watchdog: %1") << boolToYesNo(watchdog);
|
|
||||||
}
|
|
||||||
else if (parser.matchesCommand(".reinit", ".reinitialize"))
|
else if (parser.matchesCommand(".reinit", ".reinitialize"))
|
||||||
{
|
{
|
||||||
if (!m_airspace) { return false; }
|
if (!m_airspace) { return false; }
|
||||||
|
|||||||
@@ -299,10 +299,6 @@ namespace swift::misc
|
|||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
bool isEnabled() const { return m_enabled; }
|
bool isEnabled() const { return m_enabled; }
|
||||||
|
|
||||||
//! Enabled (running)?
|
|
||||||
//! \threadsafe
|
|
||||||
void setEnabled(bool enabled) { m_enabled = enabled; }
|
|
||||||
|
|
||||||
//! Start updating (start/stop timer)
|
//! Start updating (start/stop timer)
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
void startUpdating(int updateTimeSecs);
|
void startUpdating(int updateTimeSecs);
|
||||||
@@ -336,6 +332,10 @@ namespace swift::misc
|
|||||||
//! Called after cleanup().
|
//! Called after cleanup().
|
||||||
void finish();
|
void finish();
|
||||||
|
|
||||||
|
//! Enabled (running)?
|
||||||
|
//! \threadsafe
|
||||||
|
void setEnabled(bool enabled) { m_enabled = enabled; }
|
||||||
|
|
||||||
using CWorkerBase::setStarted;
|
using CWorkerBase::setStarted;
|
||||||
using CWorkerBase::setFinished;
|
using CWorkerBase::setFinished;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user