refactor: App, remove args from static startup methods to make StartupFunc no longer take args
This commit is contained in:
@ -77,6 +77,7 @@ public:
|
||||
|
||||
int run(int argc, char **argv);
|
||||
int daemonMainLoop(int, const char **);
|
||||
|
||||
void setupFileLogging();
|
||||
void loggingFilterWarning() const;
|
||||
void initApp() override;
|
||||
|
||||
@ -354,9 +354,9 @@ int ClientApp::mainLoop()
|
||||
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()
|
||||
@ -373,7 +373,7 @@ int ClientApp::runInner(int argc, char **argv, StartupFunc startup)
|
||||
int result;
|
||||
try {
|
||||
// run
|
||||
result = startup(argc, argv);
|
||||
result = startup();
|
||||
} catch (...) {
|
||||
delete m_serverAddress;
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
using StartupFunc = int (*)(int, char **);
|
||||
using StartupFunc = int (*)();
|
||||
|
||||
namespace deskflow {
|
||||
class Screen;
|
||||
|
||||
@ -616,15 +616,15 @@ int ServerApp::runInner(int argc, char **argv, StartupFunc startup)
|
||||
m_config = std::make_shared<Config>(getEvents());
|
||||
|
||||
// run
|
||||
int result = startup(argc, argv);
|
||||
int result = startup();
|
||||
|
||||
delete m_deskflowAddress;
|
||||
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()
|
||||
|
||||
@ -26,7 +26,7 @@ AppUtilUnix::AppUtilUnix(const IEventQueue *)
|
||||
// do nothing
|
||||
}
|
||||
|
||||
int startStatic(int argc, char **argv)
|
||||
int startStatic()
|
||||
{
|
||||
return AppUtil::instance().app().start();
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ static int mainLoopStatic()
|
||||
return AppUtil::instance().app().mainLoop();
|
||||
}
|
||||
|
||||
int AppUtilWindows::daemonNTMainLoop(int argc, const char **argv)
|
||||
int AppUtilWindows::daemonNTMainLoop()
|
||||
{
|
||||
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);
|
||||
m_exitMode = kExitModeDaemon;
|
||||
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)
|
||||
|
||||
@ -34,8 +34,8 @@ public:
|
||||
|
||||
static AppUtilWindows &instance();
|
||||
|
||||
int daemonNTStartup(int, char **);
|
||||
int daemonNTMainLoop(int argc, const char **argv);
|
||||
int daemonNTStartup();
|
||||
int daemonNTMainLoop();
|
||||
int run(int argc, char **argv) override;
|
||||
void exitApp(int code) override;
|
||||
void startNode() override;
|
||||
|
||||
Reference in New Issue
Block a user