Added xmrigDaemon to control xmrigMiner
Fixed some issues in CCClient and CCServer
This commit is contained in:
parent
2b97e2f4ff
commit
3f39ca31fd
15 changed files with 86 additions and 83 deletions
59
src/App.cpp
59
src/App.cpp
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <uv.h>
|
||||
#include <zconf.h>
|
||||
|
||||
#include "api/Api.h"
|
||||
#include "App.h"
|
||||
|
@ -53,7 +54,6 @@
|
|||
App *App::m_self = nullptr;
|
||||
|
||||
|
||||
|
||||
App::App(int argc, char **argv) :
|
||||
m_restart(false),
|
||||
m_console(nullptr),
|
||||
|
@ -98,31 +98,7 @@ App::App(int argc, char **argv) :
|
|||
|
||||
App::~App()
|
||||
{
|
||||
Log::release();
|
||||
Options::release();
|
||||
Mem::release();
|
||||
Platform::release();
|
||||
|
||||
delete m_network;
|
||||
|
||||
# ifndef XMRIG_NO_HTTPD
|
||||
delete m_httpd;
|
||||
# endif
|
||||
|
||||
# ifndef XMRIG_NO_CC
|
||||
delete m_ccclient;
|
||||
# endif
|
||||
|
||||
delete m_console;
|
||||
|
||||
# ifndef XMRIG_NO_API
|
||||
Api::release();
|
||||
# endif
|
||||
|
||||
uv_signal_stop(&m_signal);
|
||||
uv_tty_reset_mode();
|
||||
|
||||
m_self = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -166,10 +142,25 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
void App::onConsoleCommand(char command)
|
||||
{
|
||||
switch (command) {
|
||||
|
@ -178,11 +169,6 @@ void App::onConsoleCommand(char command)
|
|||
Workers::printHashrate(true);
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
case 'I':
|
||||
restart();
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
case 'P':
|
||||
LOG_INFO(m_options->colors() ? "\x1B[01;33mpaused\x1B[0m, press \x1B[01;35mr\x1B[0m to resume" : "paused, press 'r' to resume");
|
||||
|
@ -200,7 +186,8 @@ void App::onConsoleCommand(char command)
|
|||
case 'q':
|
||||
case 'Q':
|
||||
case 3:
|
||||
stop(false);
|
||||
LOG_INFO(m_options->colors() ? "\x1B[01;33mquitting" : "quitting");
|
||||
quit();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -224,6 +211,11 @@ void App::restart()
|
|||
m_self->stop(true);
|
||||
}
|
||||
|
||||
void App::quit()
|
||||
{
|
||||
m_self->stop(false);
|
||||
}
|
||||
|
||||
void App::onSignal(uv_signal_t *handle, int signum)
|
||||
{
|
||||
switch (signum)
|
||||
|
@ -244,5 +236,6 @@ void App::onSignal(uv_signal_t *handle, int signum)
|
|||
break;
|
||||
}
|
||||
|
||||
m_self->stop(false);
|
||||
uv_signal_stop(handle);
|
||||
App::quit();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue