Cleanup
This commit is contained in:
parent
e245b50a41
commit
d34d51d7a2
6 changed files with 25 additions and 27 deletions
36
src/App.cpp
36
src/App.cpp
|
@ -98,7 +98,21 @@ App::App(int argc, char **argv) :
|
|||
|
||||
App::~App()
|
||||
{
|
||||
delete m_network;
|
||||
|
||||
Options::release();
|
||||
Mem::release();
|
||||
Platform::release();
|
||||
|
||||
uv_tty_reset_mode();
|
||||
|
||||
# ifndef XMRIG_NO_HTTPD
|
||||
delete m_httpd;
|
||||
# endif
|
||||
|
||||
# ifndef XMRIG_NO_CC
|
||||
delete m_ccclient;
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -142,22 +156,6 @@ int App::start()
|
|||
const int r = uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
uv_loop_close(uv_default_loop());
|
||||
|
||||
delete m_network;
|
||||
|
||||
Options::release();
|
||||
Mem::release();
|
||||
Platform::release();
|
||||
|
||||
uv_tty_reset_mode();
|
||||
|
||||
# ifndef XMRIG_NO_HTTPD
|
||||
delete m_httpd;
|
||||
# endif
|
||||
|
||||
# ifndef XMRIG_NO_CC
|
||||
delete m_ccclient;
|
||||
# endif
|
||||
|
||||
return m_restart ? ERESTART : r;
|
||||
}
|
||||
|
||||
|
@ -187,7 +185,7 @@ void App::onConsoleCommand(char command)
|
|||
case 'Q':
|
||||
case 3:
|
||||
LOG_INFO(m_options->colors() ? "\x1B[01;33mquitting" : "quitting");
|
||||
quit();
|
||||
shutdown();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -211,7 +209,7 @@ void App::restart()
|
|||
m_self->stop(true);
|
||||
}
|
||||
|
||||
void App::quit()
|
||||
void App::shutdown()
|
||||
{
|
||||
m_self->stop(false);
|
||||
}
|
||||
|
@ -237,5 +235,5 @@ void App::onSignal(uv_signal_t *handle, int signum)
|
|||
}
|
||||
|
||||
uv_signal_stop(handle);
|
||||
App::quit();
|
||||
App::shutdown();
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
int start();
|
||||
|
||||
static void restart();
|
||||
static void quit();
|
||||
static void shutdown();
|
||||
|
||||
protected:
|
||||
void onConsoleCommand(char command) override;
|
||||
|
|
|
@ -155,7 +155,7 @@ static void print_commands()
|
|||
Log::i()->text("\x1B[01;32m * \x1B[01;37mCOMMANDS: \x1B[01;35mh\x1B[01;37mashrate, \x1B[01;35mp\x1B[01;37mause, \x1B[01;35mr\x1B[01;37mesume, \x1B[01;35mq\x1B[01;37muit");
|
||||
}
|
||||
else {
|
||||
Log::i()->text(" * COMMANDS: 'h' hashrate, 'p' pause, 'r' resume, 'q' quit");
|
||||
Log::i()->text(" * COMMANDS: 'h' hashrate, 'p' pause, 'r' resume, 'q' shutdown");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -130,9 +130,9 @@ void CCClient::publishClientStatusReport()
|
|||
} else if (controlCommand.getCommand() == ControlCommand::RESTART) {
|
||||
LOG_WARN("[CC-Client] Command: RESTART received -> restart");
|
||||
App::restart();
|
||||
} else if (controlCommand.getCommand() == ControlCommand::QUIT) {
|
||||
LOG_WARN("[CC-Client] Command: QUIT received -> quit");
|
||||
App::quit();
|
||||
} else if (controlCommand.getCommand() == ControlCommand::SHUTDOWN) {
|
||||
LOG_WARN("[CC-Client] Command: SHUTDOWN received -> shutdown");
|
||||
App::shutdown();
|
||||
}
|
||||
} else {
|
||||
LOG_ERR("[CC-Client] Unknown command received from CC Server.");
|
||||
|
|
|
@ -95,5 +95,5 @@ bool ControlCommand::isOneTimeCommand() const {
|
|||
|
||||
return m_command == ControlCommand::UPDATE_CONFIG ||
|
||||
m_command == ControlCommand::RESTART ||
|
||||
m_command == ControlCommand::QUIT;
|
||||
m_command == ControlCommand::SHUTDOWN;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
STOP,
|
||||
UPDATE_CONFIG,
|
||||
RESTART,
|
||||
QUIT
|
||||
SHUTDOWN
|
||||
};
|
||||
|
||||
public:
|
||||
|
@ -75,7 +75,7 @@ private:
|
|||
"STOP",
|
||||
"UPDATE_CONFIG",
|
||||
"RESTART",
|
||||
"QUIT"
|
||||
"SHUTDOWN"
|
||||
};
|
||||
|
||||
Command m_command;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue