mirror of
https://github.com/xmrig/xmrig.git
synced 2025-01-11 05:14:40 +00:00
Fixed initialization, no need init logs and network if configuration not ready.
This commit is contained in:
parent
92d787c817
commit
1720d3e096
3 changed files with 12 additions and 5 deletions
|
@ -59,6 +59,9 @@ App::App(int argc, char **argv) :
|
||||||
|
|
||||||
Cpu::init();
|
Cpu::init();
|
||||||
m_options = Options::parse(argc, argv);
|
m_options = Options::parse(argc, argv);
|
||||||
|
if (!m_options) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Log::init();
|
Log::init();
|
||||||
|
|
||||||
|
@ -91,7 +94,7 @@ App::~App()
|
||||||
|
|
||||||
int App::exec()
|
int App::exec()
|
||||||
{
|
{
|
||||||
if (!m_options->isReady()) {
|
if (!m_options) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,11 +181,14 @@ static char *defaultConfigName()
|
||||||
|
|
||||||
Options *Options::parse(int argc, char **argv)
|
Options *Options::parse(int argc, char **argv)
|
||||||
{
|
{
|
||||||
if (!m_self) {
|
Options *options = new Options(argc, argv);
|
||||||
m_self = new Options(argc, argv);
|
if (options->isReady()) {
|
||||||
|
m_self = options;
|
||||||
|
return m_self;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_self;
|
delete options;
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,6 @@ public:
|
||||||
inline bool background() const { return m_background; }
|
inline bool background() const { return m_background; }
|
||||||
inline bool colors() const { return m_colors; }
|
inline bool colors() const { return m_colors; }
|
||||||
inline bool doubleHash() const { return m_doubleHash; }
|
inline bool doubleHash() const { return m_doubleHash; }
|
||||||
inline bool isReady() const { return m_ready; }
|
|
||||||
inline bool syslog() const { return m_syslog; }
|
inline bool syslog() const { return m_syslog; }
|
||||||
inline const char *logFile() const { return m_logFile; }
|
inline const char *logFile() const { return m_logFile; }
|
||||||
inline const std::vector<Url*> &pools() const { return m_pools; }
|
inline const std::vector<Url*> &pools() const { return m_pools; }
|
||||||
|
@ -76,6 +75,8 @@ private:
|
||||||
Options(int argc, char **argv);
|
Options(int argc, char **argv);
|
||||||
~Options();
|
~Options();
|
||||||
|
|
||||||
|
inline bool isReady() const { return m_ready; }
|
||||||
|
|
||||||
static Options *m_self;
|
static Options *m_self;
|
||||||
|
|
||||||
bool parseArg(int key, const char *arg);
|
bool parseArg(int key, const char *arg);
|
||||||
|
|
Loading…
Reference in a new issue