refactor: App, remove args from static startup methods to make StartupFunc no longer take args
This commit is contained in:
parent
9f2327932d
commit
3270b40455
7 changed files with 17 additions and 16 deletions
|
|
@ -77,6 +77,7 @@ public:
|
||||||
|
|
||||||
int run(int argc, char **argv);
|
int run(int argc, char **argv);
|
||||||
int daemonMainLoop(int, const char **);
|
int daemonMainLoop(int, const char **);
|
||||||
|
|
||||||
void setupFileLogging();
|
void setupFileLogging();
|
||||||
void loggingFilterWarning() const;
|
void loggingFilterWarning() const;
|
||||||
void initApp() override;
|
void initApp() override;
|
||||||
|
|
|
||||||
|
|
@ -354,9 +354,9 @@ int ClientApp::mainLoop()
|
||||||
return s_exitSuccess;
|
return s_exitSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int daemonMainLoopStatic(int argc, const char **argv)
|
static int daemonMainLoopStatic()
|
||||||
{
|
{
|
||||||
return ClientApp::instance().daemonMainLoop(argc, argv);
|
return ClientApp::instance().daemonMainLoop(0, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ClientApp::start()
|
int ClientApp::start()
|
||||||
|
|
@ -373,7 +373,7 @@ int ClientApp::runInner(int argc, char **argv, StartupFunc startup)
|
||||||
int result;
|
int result;
|
||||||
try {
|
try {
|
||||||
// run
|
// run
|
||||||
result = startup(argc, argv);
|
result = startup();
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
delete m_serverAddress;
|
delete m_serverAddress;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
using StartupFunc = int (*)(int, char **);
|
using StartupFunc = int (*)();
|
||||||
|
|
||||||
namespace deskflow {
|
namespace deskflow {
|
||||||
class Screen;
|
class Screen;
|
||||||
|
|
|
||||||
|
|
@ -616,15 +616,15 @@ int ServerApp::runInner(int argc, char **argv, StartupFunc startup)
|
||||||
m_config = std::make_shared<Config>(getEvents());
|
m_config = std::make_shared<Config>(getEvents());
|
||||||
|
|
||||||
// run
|
// run
|
||||||
int result = startup(argc, argv);
|
int result = startup();
|
||||||
|
|
||||||
delete m_deskflowAddress;
|
delete m_deskflowAddress;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int daemonMainLoopStatic(int argc, const char **argv)
|
int daemonMainLoopStatic()
|
||||||
{
|
{
|
||||||
return ServerApp::instance().daemonMainLoop(argc, argv);
|
return ServerApp::instance().daemonMainLoop(0, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ServerApp::start()
|
int ServerApp::start()
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ AppUtilUnix::AppUtilUnix(const IEventQueue *)
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
int startStatic(int argc, char **argv)
|
int startStatic()
|
||||||
{
|
{
|
||||||
return AppUtil::instance().app().start();
|
return AppUtil::instance().app().start();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ static int mainLoopStatic()
|
||||||
return AppUtil::instance().app().mainLoop();
|
return AppUtil::instance().app().mainLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
int AppUtilWindows::daemonNTMainLoop(int argc, const char **argv)
|
int AppUtilWindows::daemonNTMainLoop()
|
||||||
{
|
{
|
||||||
app().initApp();
|
app().initApp();
|
||||||
|
|
||||||
|
|
@ -80,21 +80,21 @@ void AppUtilWindows::exitApp(int code)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int daemonNTMainLoopStatic(int argc, const char **argv)
|
int daemonNTMainLoopStatic()
|
||||||
{
|
{
|
||||||
return AppUtilWindows::instance().daemonNTMainLoop(argc, argv);
|
return AppUtilWindows::instance().daemonNTMainLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
int AppUtilWindows::daemonNTStartup(int, char **)
|
int AppUtilWindows::daemonNTStartup()
|
||||||
{
|
{
|
||||||
SystemLogger sysLogger(app().daemonName(), false);
|
SystemLogger sysLogger(app().daemonName(), false);
|
||||||
m_exitMode = kExitModeDaemon;
|
m_exitMode = kExitModeDaemon;
|
||||||
return ARCH->daemonize(app().daemonName(), daemonNTMainLoopStatic);
|
return ARCH->daemonize(app().daemonName(), daemonNTMainLoopStatic);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int daemonNTStartupStatic(int argc, char **argv)
|
static int daemonNTStartupStatic()
|
||||||
{
|
{
|
||||||
return AppUtilWindows::instance().daemonNTStartup(argc, argv);
|
return AppUtilWindows::instance().daemonNTStartup();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int foregroundStartupStatic(int argc, char **argv)
|
static int foregroundStartupStatic(int argc, char **argv)
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,8 @@ public:
|
||||||
|
|
||||||
static AppUtilWindows &instance();
|
static AppUtilWindows &instance();
|
||||||
|
|
||||||
int daemonNTStartup(int, char **);
|
int daemonNTStartup();
|
||||||
int daemonNTMainLoop(int argc, const char **argv);
|
int daemonNTMainLoop();
|
||||||
int run(int argc, char **argv) override;
|
int run(int argc, char **argv) override;
|
||||||
void exitApp(int code) override;
|
void exitApp(int code) override;
|
||||||
void startNode() override;
|
void startNode() override;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue