From af0a6fdf2056e311d14009da4b8e31a7f56798a2 Mon Sep 17 00:00:00 2001 From: XMRig Date: Sat, 31 Mar 2018 17:51:33 +0700 Subject: [PATCH] Small fixes. --- src/App.cpp | 2 +- src/Summary.cpp | 6 ++++-- src/core/CommonConfig.cpp | 2 ++ src/core/Controller.cpp | 6 ++++++ src/core/Controller.h | 1 + 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/App.cpp b/src/App.cpp index 612614ae..9bdd381e 100644 --- a/src/App.cpp +++ b/src/App.cpp @@ -91,7 +91,7 @@ App::~App() int App::exec() { - if (!m_controller->config()) { + if (!m_controller->isReady()) { return 2; } diff --git a/src/Summary.cpp b/src/Summary.cpp index 4b663fbf..6aa42b74 100644 --- a/src/Summary.cpp +++ b/src/Summary.cpp @@ -132,11 +132,13 @@ static void print_pools(xmrig::Config *config) #ifndef XMRIG_NO_API static void print_api(xmrig::Config *config) { - if (config->apiPort() == 0) { + const int port = config->apiPort(); + if (port == 0) { return; } - Log::i()->text(config->isColors() ? "\x1B[01;32m * \x1B[01;37mAPI PORT: \x1B[01;36m%d" : " * API PORT: %d", config->apiPort()); + Log::i()->text(config->isColors() ? "\x1B[01;32m * \x1B[01;37mAPI BIND: \x1B[01;36m%s:%d" : " * API BIND: %s:%d", + config->isApiIPv6() ? "[::]" : "0.0.0.0", port); } #endif diff --git a/src/core/CommonConfig.cpp b/src/core/CommonConfig.cpp index 38233b12..ea17342c 100644 --- a/src/core/CommonConfig.cpp +++ b/src/core/CommonConfig.cpp @@ -56,6 +56,8 @@ xmrig::CommonConfig::CommonConfig() : m_apiRestricted(true), m_background(false), m_colors(true), + m_syslog(false), + m_watch(false), // TODO: enable config file watch by default when this feature propertly handled and tested. m_apiToken(nullptr), m_apiWorkerId(nullptr), m_fileName(nullptr), diff --git a/src/core/Controller.cpp b/src/core/Controller.cpp index 35fab2a2..805861ef 100644 --- a/src/core/Controller.cpp +++ b/src/core/Controller.cpp @@ -79,6 +79,12 @@ xmrig::Controller::~Controller() } +bool xmrig::Controller::isReady() const +{ + return d_ptr->config && d_ptr->network; +} + + xmrig::Config *xmrig::Controller::config() const { assert(d_ptr->config != nullptr); diff --git a/src/core/Controller.h b/src/core/Controller.h index 2ba80f99..25f91843 100644 --- a/src/core/Controller.h +++ b/src/core/Controller.h @@ -46,6 +46,7 @@ public: Controller(); ~Controller(); + bool isReady() const; Config *config() const; int init(int argc, char **argv); Network *network() const;