refactor: Use member instead of passing param in daemon main loop
This commit is contained in:
parent
13ed447a93
commit
54483f26ba
2 changed files with 4 additions and 6 deletions
|
|
@ -64,7 +64,7 @@ void DaemonApp::run()
|
||||||
{
|
{
|
||||||
if (m_foreground) {
|
if (m_foreground) {
|
||||||
LOG_DEBUG("running daemon in foreground");
|
LOG_DEBUG("running daemon in foreground");
|
||||||
mainLoop(m_foreground);
|
mainLoop();
|
||||||
} else {
|
} else {
|
||||||
LOG_DEBUG("running daemon in background (daemonizing)");
|
LOG_DEBUG("running daemon in background (daemonizing)");
|
||||||
ARCH->daemonize(kAppName, daemonLoop);
|
ARCH->daemonize(kAppName, daemonLoop);
|
||||||
|
|
@ -202,7 +202,7 @@ DaemonApp::InitResult DaemonApp::init(IEventQueue *events, int argc, char **argv
|
||||||
return StartDaemon;
|
return StartDaemon;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DaemonApp::mainLoop(bool foreground)
|
void DaemonApp::mainLoop()
|
||||||
{
|
{
|
||||||
if (m_events == nullptr) {
|
if (m_events == nullptr) {
|
||||||
throw XDeskflow("event queue not set");
|
throw XDeskflow("event queue not set");
|
||||||
|
|
@ -212,7 +212,7 @@ void DaemonApp::mainLoop(bool foreground)
|
||||||
DAEMON_RUNNING(true);
|
DAEMON_RUNNING(true);
|
||||||
|
|
||||||
#if SYSAPI_WIN32
|
#if SYSAPI_WIN32
|
||||||
m_watchdog = std::make_unique<MSWindowsWatchdog>(false, foreground);
|
m_watchdog = std::make_unique<MSWindowsWatchdog>(false, m_foreground);
|
||||||
m_watchdog->setFileLogOutputter(m_fileLogOutputter);
|
m_watchdog->setFileLogOutputter(m_fileLogOutputter);
|
||||||
|
|
||||||
// install the platform event queue to handle service stop events.
|
// install the platform event queue to handle service stop events.
|
||||||
|
|
|
||||||
|
|
@ -46,10 +46,8 @@ public:
|
||||||
|
|
||||||
InitResult init(IEventQueue *events, int argc, char **argv);
|
InitResult init(IEventQueue *events, int argc, char **argv);
|
||||||
void run();
|
void run();
|
||||||
void restartCoreProcess();
|
void mainLoop();
|
||||||
void saveLogLevel(const QString &logLevel) const;
|
void saveLogLevel(const QString &logLevel) const;
|
||||||
void mainLoop(bool foreground = false);
|
|
||||||
void setLogLevel(const QString &logLevel);
|
|
||||||
void setElevate(bool elevate);
|
void setElevate(bool elevate);
|
||||||
void setCommand(const QString &command);
|
void setCommand(const QString &command);
|
||||||
void applyWatchdogCommand() const;
|
void applyWatchdogCommand() const;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue