Added real graceful exit.

This commit is contained in:
XMRig 2019-03-16 00:44:15 +07:00
parent 1e62943010
commit ba68fb6c53
41 changed files with 391 additions and 303 deletions

View file

@ -75,8 +75,6 @@ xmrig::Controller::Controller(Process *process)
xmrig::Controller::~Controller()
{
ConfigLoader::release();
delete d_ptr;
}
@ -109,11 +107,11 @@ int xmrig::Controller::init()
Platform::setProcessPriority(d_ptr->config->priority());
if (!config()->isBackground()) {
Log::add(new ConsoleLog(this));
Log::add(new ConsoleLog());
}
if (config()->logFile()) {
Log::add(new FileLog(this, config()->logFile()));
Log::add(new FileLog(config()->logFile()));
}
# ifdef HAVE_SYSLOG_H
@ -166,3 +164,12 @@ void xmrig::Controller::onNewConfig(IConfig *config)
delete previousConfig;
}
void xmrig::Controller::stop()
{
ConfigLoader::release();
delete d_ptr->network;
d_ptr->network = nullptr;
}

View file

@ -54,6 +54,7 @@ public:
Network *network() const;
void addListener(IControllerListener *listener);
void save();
void stop();
protected:
void onNewConfig(IConfig *config) override;