Prevent config reload after initial save.
This commit is contained in:
parent
f4d2dec628
commit
14e7c82512
6 changed files with 31 additions and 13 deletions
|
@ -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();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue