diff --git a/src/Options.cpp b/src/Options.cpp index 7392eb13..9b24e6ae 100644 --- a/src/Options.cpp +++ b/src/Options.cpp @@ -97,7 +97,8 @@ Options:\n" --cc-access-token=T access token for CC Server\n\ --cc-worker-id=ID custom worker-id for CC Server\n\ --cc-update-interval-s=N status update interval in seconds (default: 10 min: 1)\n\ - --cc-use-remote-logging enable remote logging on CC Server\n" + --cc-use-remote-logging enable remote logging on CC Server\n\ + --cc-upload-config-on-startup upload current miner config to CC Server on startup\n" # endif # endif @@ -182,8 +183,9 @@ static struct option const options[] = { { "cc-cert-file", 1, nullptr, 4014 }, { "cc-key-file", 1, nullptr, 4015 }, { "cc-use-tls", 0, nullptr, 4016 }, - { "cc-use-remote-logging", 0, nullptr, 4017 }, + { "cc-use-remote-logging", 0, nullptr, 4017 }, { "cc-client-log-lines-history", 1, nullptr, 4018 }, + { "cc-upload-config-on-startup", 0, nullptr, 4019 }, { "daemonized", 0, nullptr, 4011 }, { "doublehash-thread-mask", 1, nullptr, 4013 }, { "multihash-thread-mask", 1, nullptr, 4013 }, @@ -246,6 +248,7 @@ static struct option const cc_client_options[] = { { "update-interval-s", 1, nullptr, 4012 }, { "use-tls", 0, nullptr, 4016 }, { "use-remote-logging", 0, nullptr, 4017 }, + { "upload-config-on-startup", 0, nullptr, 4019 }, { nullptr, 0, nullptr, 0 } }; @@ -320,6 +323,7 @@ Options::Options(int argc, char **argv) : m_daemonized(false), m_ccUseTls(false), m_ccUseRemoteLogging(true), + m_ccUploadConfigOnStartup(true), m_configFile(Platform::defaultConfigName()), m_apiToken(nullptr), m_apiWorkerId(nullptr), @@ -587,6 +591,9 @@ bool Options::parseArg(int key, const char *arg) case 4017: /* --cc-use-remote-logging */ return parseBoolean(key, true); + case 4019: /* --cc-upload-config-on-startup */ + return parseBoolean(key, true); + case 't': /* --threads */ if (strncmp(arg, "all", 3) == 0) { m_threads = Cpu::threads(); @@ -823,6 +830,10 @@ bool Options::parseBoolean(int key, bool enable) m_ccUseRemoteLogging = enable; break; + case 4019: /* --cc-upload-config-on-startup */ + m_ccUploadConfigOnStartup = enable; + break; + default: break; } diff --git a/src/Options.h b/src/Options.h index cc89e887..799980af 100644 --- a/src/Options.h +++ b/src/Options.h @@ -73,6 +73,7 @@ public: inline bool daemonized() const { return m_daemonized; } inline bool ccUseTls() const { return m_ccUseTls; } inline bool ccUseRemoteLogging() const { return m_ccUseRemoteLogging; } + inline bool ccUploadConfigOnStartup() const { return m_ccUploadConfigOnStartup; } inline const char *configFile() const { return m_configFile; } inline const char *apiToken() const { return m_apiToken; } inline const char *apiWorkerId() const { return m_apiWorkerId; } @@ -147,6 +148,7 @@ private: bool m_daemonized; bool m_ccUseTls; bool m_ccUseRemoteLogging; + bool m_ccUploadConfigOnStartup; const char* m_configFile; char *m_apiToken; char *m_apiWorkerId; diff --git a/src/cc/CCClient.cpp b/src/cc/CCClient.cpp index 596f2731..beae6d3e 100644 --- a/src/cc/CCClient.cpp +++ b/src/cc/CCClient.cpp @@ -320,7 +320,9 @@ void CCClient::onThreadStarted(void* handle) static_cast(m_self->m_options->ccUpdateInterval() * 1000), static_cast(m_self->m_options->ccUpdateInterval() * 1000)); - m_self->publishConfig(); + if (m_self->m_options->ccUploadConfigOnStartup()) { + m_self->publishConfig(); + } uv_run(&m_self->m_client_loop, UV_RUN_DEFAULT); } diff --git a/src/cc/Service.cpp b/src/cc/Service.cpp index 6c9e317b..03a885ff 100644 --- a/src/cc/Service.cpp +++ b/src/cc/Service.cpp @@ -288,8 +288,6 @@ unsigned Service::getClientLog(const std::string& clientId, std::string& resp) data << m_row.c_str() << std::endl; } - LOG_INFO("LOG: %s", data.str().c_str()); - respDocument.AddMember("client_log", rapidjson::StringRef(data.str().c_str()), allocator); rapidjson::StringBuffer buffer(0, 4096); diff --git a/src/config.json b/src/config.json index 2a8aab50..1b5f397b 100644 --- a/src/config.json +++ b/src/config.json @@ -35,6 +35,7 @@ "worker-id": null, // custom worker-id for CC Server (otherwise hostname is used) "update-interval-s": 10, // status update interval in seconds (default: 10 min: 1) "use-remote-logging" : true, // enable remote logging on CC Server - "remote-logging-max-rows" : 20 // maximum last n-log rows to send CC Server + "remote-logging-max-rows" : 20, // maximum last n-log rows to send CC Server + "upload-config-on-startup" : true // upload current miner config to CC Server on startup } } diff --git a/src/default_config.json b/src/default_config.json index 2a8aab50..a92a4424 100644 --- a/src/default_config.json +++ b/src/default_config.json @@ -5,7 +5,7 @@ "multihash-factor": 0, // number of hash blocks to process at a time (not set or 0 enables automatic selection of optimal number of hash blocks) "multihash-thread-mask" : null, // for multihash-factors>0 only, limits multihash to given threads (mask), mask "0x3" means run multihash on thread 0 and 1 only (default: all threads) "pow-variant" : "auto", // specificy the PoW variat to use: -> auto (default), 0 (v0), 1 (v1, aka monerov7, aeonv7), tube (ipbc), alloy, xtl (including autodetect for v5), msr, xhv, rto - // for further help see: https://github.com/Bendr0id/xmrigCC/wiki/Coin-configurations + // for further help see: https://github.com/Bendr0id/xmrigCC/wiki/Coin-configurations "background": false, // true to run the miner in the background (Windows only, for *nix plase use screen/tmux or systemd service instead) "colors": true, // false to disable colored output "cpu-affinity": null, // set process affinity to CPU core(s), mask "0x3" for cores 0 and 1 @@ -35,6 +35,7 @@ "worker-id": null, // custom worker-id for CC Server (otherwise hostname is used) "update-interval-s": 10, // status update interval in seconds (default: 10 min: 1) "use-remote-logging" : true, // enable remote logging on CC Server - "remote-logging-max-rows" : 20 // maximum last n-log rows to send CC Server + "remote-logging-max-rows" : 20, // maximum last n-log rows to send CC Server + "upload-config-on-startup" : true // upload current miner config to CC Server on startup } } diff --git a/src/version.h b/src/version.h index 3bc2011d..3d91f8c3 100644 --- a/src/version.h +++ b/src/version.h @@ -36,14 +36,14 @@ #define APP_DESC "XMRigCC CPU miner" #define APP_COPYRIGHT "Copyright (C) 2017- BenDr0id" #endif -#define APP_VERSION "1.6.5 (based on XMRig)" +#define APP_VERSION "1.6.6_beta1 (based on XMRig)" #define APP_DOMAIN "" #define APP_SITE "https://github.com/Bendr0id/xmrigCC" #define APP_KIND "cpu" #define APP_VER_MAJOR 1 #define APP_VER_MINOR 6 -#define APP_VER_BUILD 5 +#define APP_VER_BUILD 6 #define APP_VER_REV 0 #ifndef NDEBUG