mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-25 13:42:54 -05:00
Prevent config reload after initial save.
This commit is contained in:
@@ -74,13 +74,7 @@ xmrig::CommonConfig::CommonConfig() :
|
||||
m_colors(true),
|
||||
m_dryRun(false),
|
||||
m_syslog(false),
|
||||
|
||||
# ifdef XMRIG_PROXY_PROJECT
|
||||
m_watch(true),
|
||||
# else
|
||||
m_watch(false), // TODO: enable config file watch by default when this feature propertly handled and tested.
|
||||
# endif
|
||||
|
||||
m_apiPort(0),
|
||||
m_donateLevel(kDefaultDonateLevel),
|
||||
m_printTime(60),
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <uv.h>
|
||||
@@ -145,6 +146,19 @@ bool xmrig::ConfigLoader::reload(xmrig::IConfig *oldConfig, const char *json)
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::ConfigLoader::watch(IConfig *config)
|
||||
{
|
||||
if (!config->isWatch()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
assert(m_watcher == nullptr);
|
||||
|
||||
m_watcher = new xmrig::ConfigWatcher(config->fileName(), m_creator, m_listener);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
xmrig::IConfig *xmrig::ConfigLoader::load(Process *process, IConfigCreator *creator, IConfigListener *listener)
|
||||
{
|
||||
m_creator = creator;
|
||||
@@ -192,10 +206,6 @@ xmrig::IConfig *xmrig::ConfigLoader::load(Process *process, IConfigCreator *crea
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (config->isWatch()) {
|
||||
m_watcher = new xmrig::ConfigWatcher(config->fileName(), creator, listener);
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ public:
|
||||
static bool loadFromJSON(IConfig *config, const char *json);
|
||||
static bool loadFromJSON(IConfig *config, const rapidjson::Document &doc);
|
||||
static bool reload(IConfig *oldConfig, const char *json);
|
||||
static bool watch(IConfig *config);
|
||||
static IConfig *load(Process *process, IConfigCreator *creator, IConfigListener *listener);
|
||||
static void release();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user