refactor: App make m_bye private access it from the method bye
This commit is contained in:
parent
3b2b8a9ebe
commit
1968669a39
3 changed files with 11 additions and 11 deletions
|
|
@ -113,9 +113,9 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void runEventsLoop(void *);
|
void runEventsLoop(void *);
|
||||||
void (*m_bye)(int);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void (*m_bye)(int);
|
||||||
IEventQueue *m_events = nullptr;
|
IEventQueue *m_events = nullptr;
|
||||||
deskflow::ArgsBase *m_args;
|
deskflow::ArgsBase *m_args;
|
||||||
static App *s_instance;
|
static App *s_instance;
|
||||||
|
|
|
||||||
|
|
@ -72,9 +72,9 @@ void ClientApp::parseArgs(int argc, const char *const *argv)
|
||||||
|
|
||||||
if (!result || args().m_shouldExitOk || args().m_shouldExitFail) {
|
if (!result || args().m_shouldExitOk || args().m_shouldExitFail) {
|
||||||
if (args().m_shouldExitOk) {
|
if (args().m_shouldExitOk) {
|
||||||
m_bye(s_exitSuccess);
|
bye(s_exitSuccess);
|
||||||
} else {
|
} else {
|
||||||
m_bye(s_exitArgs);
|
bye(s_exitArgs);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// save server address
|
// save server address
|
||||||
|
|
@ -89,7 +89,7 @@ void ClientApp::parseArgs(int argc, const char *const *argv)
|
||||||
// Priddy.
|
// Priddy.
|
||||||
if (!args().m_restartable || e.getError() == XSocketAddress::SocketError::BadPort) {
|
if (!args().m_restartable || e.getError() == XSocketAddress::SocketError::BadPort) {
|
||||||
LOG((CLOG_CRIT "%s: %s" BYE, args().m_pname, e.what(), args().m_pname));
|
LOG((CLOG_CRIT "%s: %s" BYE, args().m_pname, e.what(), args().m_pname));
|
||||||
m_bye(s_exitFailed);
|
bye(s_exitFailed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -442,7 +442,7 @@ void ClientApp::startNode()
|
||||||
// we shouldn't retry.
|
// we shouldn't retry.
|
||||||
LOG((CLOG_DEBUG1 "starting client"));
|
LOG((CLOG_DEBUG1 "starting client"));
|
||||||
if (!startClient()) {
|
if (!startClient()) {
|
||||||
m_bye(s_exitFailed);
|
bye(s_exitFailed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,9 +80,9 @@ void ServerApp::parseArgs(int argc, const char *const *argv)
|
||||||
|
|
||||||
if (!result || args().m_shouldExitOk || args().m_shouldExitFail) {
|
if (!result || args().m_shouldExitOk || args().m_shouldExitFail) {
|
||||||
if (args().m_shouldExitOk) {
|
if (args().m_shouldExitOk) {
|
||||||
m_bye(s_exitSuccess);
|
bye(s_exitSuccess);
|
||||||
} else {
|
} else {
|
||||||
m_bye(s_exitArgs);
|
bye(s_exitArgs);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!args().m_deskflowAddress.empty()) {
|
if (!args().m_deskflowAddress.empty()) {
|
||||||
|
|
@ -91,7 +91,7 @@ void ServerApp::parseArgs(int argc, const char *const *argv)
|
||||||
m_deskflowAddress->resolve();
|
m_deskflowAddress->resolve();
|
||||||
} catch (XSocketAddress &e) {
|
} catch (XSocketAddress &e) {
|
||||||
LOG((CLOG_CRIT "%s: %s" BYE, args().m_pname, e.what(), args().m_pname));
|
LOG((CLOG_CRIT "%s: %s" BYE, args().m_pname, e.what(), args().m_pname));
|
||||||
m_bye(s_exitArgs);
|
bye(s_exitArgs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -162,12 +162,12 @@ void ServerApp::loadConfig()
|
||||||
const auto path = args().m_configFile;
|
const auto path = args().m_configFile;
|
||||||
if (path.empty()) {
|
if (path.empty()) {
|
||||||
LOG((CLOG_CRIT "no configuration path provided"));
|
LOG((CLOG_CRIT "no configuration path provided"));
|
||||||
m_bye(s_exitConfig);
|
bye(s_exitConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!loadConfig(path)) {
|
if (!loadConfig(path)) {
|
||||||
LOG((CLOG_CRIT "%s: failed to load config: %s", args().m_pname, path.c_str()));
|
LOG((CLOG_CRIT "%s: failed to load config: %s", args().m_pname, path.c_str()));
|
||||||
m_bye(s_exitConfig);
|
bye(s_exitConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -721,6 +721,6 @@ void ServerApp::startNode()
|
||||||
// we shouldn't retry.
|
// we shouldn't retry.
|
||||||
LOG((CLOG_DEBUG1 "starting server"));
|
LOG((CLOG_DEBUG1 "starting server"));
|
||||||
if (!startServer()) {
|
if (!startServer()) {
|
||||||
m_bye(s_exitFailed);
|
bye(s_exitFailed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue