-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add support for reloading the pool config file while miner is running #1655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from 5 commits
dd2d1a7
7876501
def00e0
ab8916b
851a411
0409295
1d5b3e1
6c71d53
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,7 @@ | |
| #include "xmrstak/donate-level.hpp" | ||
| #include "xmrstak/version.hpp" | ||
| #include "xmrstak/http/webdesign.hpp" | ||
| #include "xmrstak/params.hpp" | ||
|
|
||
| #include <thread> | ||
| #include <string> | ||
|
|
@@ -487,26 +488,8 @@ void disable_sigpipe() | |
| inline void disable_sigpipe() {} | ||
| #endif | ||
|
|
||
| void executor::ex_main() | ||
| { | ||
| disable_sigpipe(); | ||
|
|
||
| assert(1000 % iTickTime == 0); | ||
|
|
||
| xmrstak::miner_work oWork = xmrstak::miner_work(); | ||
|
|
||
| // \todo collect all backend threads | ||
| pvThreads = xmrstak::BackendConnector::thread_starter(oWork); | ||
|
|
||
| if(pvThreads->size()==0) | ||
| { | ||
| printer::inst()->print_msg(L1, "ERROR: No miner backend enabled."); | ||
| win_exit(); | ||
| } | ||
|
|
||
| telem = new xmrstak::telemetry(pvThreads->size()); | ||
|
|
||
| set_timestamp(); | ||
| void executor::init_pools(void) | ||
| { | ||
| size_t pc = jconf::inst()->GetPoolCount(); | ||
| bool dev_tls = true; | ||
| bool already_have_cli_pool = false; | ||
|
|
@@ -539,6 +522,7 @@ void executor::ex_main() | |
| else | ||
| pools.emplace_back(i+1, cfg.sPoolAddr, cfg.sWalletAddr, cfg.sRigId, cfg.sPasswd, cfg.weight, false, cfg.tls, cfg.tls_fingerprint, cfg.nicehash); | ||
| } | ||
|
|
||
|
|
||
| if(!xmrstak::params::inst().poolURL.empty() && !already_have_cli_pool) | ||
| { | ||
|
|
@@ -551,42 +535,80 @@ void executor::ex_main() | |
|
|
||
| pools.emplace_back(i+1, params.poolURL.c_str(), params.poolUsername.c_str(), params.poolRigid.c_str(), params.poolPasswd.c_str(), 9.9, false, params.poolUseTls, "", params.nicehashMode); | ||
| } | ||
|
|
||
| switch(jconf::inst()->GetCurrentCoinSelection().GetDescription(0).GetMiningAlgo()) | ||
| { | ||
| case cryptonight_heavy: | ||
| if(dev_tls) | ||
| pools.emplace_front(0, "donate.xmr-stak.net:8888", "", "", "", 0.0, true, true, "", true); | ||
| else | ||
| pools.emplace_front(0, "donate.xmr-stak.net:5555", "", "", "", 0.0, true, false, "", true); | ||
| break; | ||
| case cryptonight_heavy: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you please remove all style changes that we can focus on the code.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this is fixed now |
||
| if(dev_tls) | ||
| pools.emplace_front(0, "donate.xmr-stak.net:8888", "", "", "", 0.0, true, true, "", true); | ||
| else | ||
| pools.emplace_front(0, "donate.xmr-stak.net:5555", "", "", "", 0.0, true, false, "", true); | ||
| break; | ||
|
|
||
| case cryptonight_monero: | ||
| if(dev_tls) | ||
| pools.emplace_front(0, "donate.xmr-stak.net:8800", "", "", "", 0.0, true, true, "", false); | ||
| else | ||
| pools.emplace_front(0, "donate.xmr-stak.net:5500", "", "", "", 0.0, true, false, "", false); | ||
| break; | ||
| case cryptonight_ipbc: | ||
| case cryptonight_aeon: | ||
| case cryptonight_lite: | ||
| if(dev_tls) | ||
| pools.emplace_front(0, "donate.xmr-stak.net:7777", "", "", "", 0.0, true, true, "", true); | ||
| else | ||
| pools.emplace_front(0, "donate.xmr-stak.net:4444", "", "", "", 0.0, true, false, "", true); | ||
| break; | ||
| case cryptonight_monero: | ||
| if(dev_tls) | ||
| pools.emplace_front(0, "donate.xmr-stak.net:8800", "", "", "", 0.0, true, true, "", false); | ||
| else | ||
| pools.emplace_front(0, "donate.xmr-stak.net:5500", "", "", "", 0.0, true, false, "", false); | ||
| break; | ||
| case cryptonight_ipbc: | ||
| case cryptonight_aeon: | ||
| case cryptonight_lite: | ||
| if(dev_tls) | ||
| pools.emplace_front(0, "donate.xmr-stak.net:7777", "", "", "", 0.0, true, true, "", true); | ||
| else | ||
| pools.emplace_front(0, "donate.xmr-stak.net:4444", "", "", "", 0.0, true, false, "", true); | ||
| break; | ||
|
|
||
| case cryptonight: | ||
| if(dev_tls) | ||
| pools.emplace_front(0, "donate.xmr-stak.net:6666", "", "", "", 0.0, true, true, "", false); | ||
| else | ||
| pools.emplace_front(0, "donate.xmr-stak.net:3333", "", "", "", 0.0, true, false, "", false); | ||
| break; | ||
| case cryptonight: | ||
| if(dev_tls) | ||
| pools.emplace_front(0, "donate.xmr-stak.net:6666", "", "", "", 0.0, true, true, "", false); | ||
| else | ||
| pools.emplace_front(0, "donate.xmr-stak.net:3333", "", "", "", 0.0, true, false, "", false); | ||
| break; | ||
|
|
||
| default: | ||
| break; | ||
| default: | ||
| break; | ||
| } | ||
|
|
||
| } | ||
|
|
||
|
|
||
| void executor::on_pools_reload(void) | ||
| { | ||
| if(!jconf::inst()->parse_config(xmrstak::params::inst().configFile.c_str(), xmrstak::params::inst().configFilePools.c_str())) | ||
| printer::inst()->print_msg(L1, "ERROR: Failed to reload pools"); | ||
| else | ||
| { | ||
| pools.clear(); | ||
| init_pools(); | ||
| printer::inst()->print_msg(L1, "Pool list updated"); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| void executor::ex_main() | ||
| { | ||
| disable_sigpipe(); | ||
|
|
||
| assert(1000 % iTickTime == 0); | ||
|
|
||
| xmrstak::miner_work oWork = xmrstak::miner_work(); | ||
|
|
||
| // \todo collect all backend threads | ||
| pvThreads = xmrstak::BackendConnector::thread_starter(oWork); | ||
|
|
||
| if(pvThreads->size()==0) | ||
| { | ||
| printer::inst()->print_msg(L1, "ERROR: No miner backend enabled."); | ||
| win_exit(); | ||
| } | ||
|
|
||
| telem = new xmrstak::telemetry(pvThreads->size()); | ||
|
|
||
| set_timestamp(); | ||
| init_pools(); | ||
|
|
||
| ex_event ev; | ||
| std::thread clock_thd(&executor::ex_clock_thd, this); | ||
|
|
||
|
|
@@ -600,7 +622,7 @@ void executor::ex_main() | |
| if(jconf::inst()->GetVerboseLevel() >= 4) | ||
| push_timed_event(ex_event(EV_HASHRATE_LOOP), jconf::inst()->GetAutohashTime()); | ||
|
|
||
| size_t cnt = 0; | ||
| size_t cnt = 0,i=0; | ||
|
||
| while (true) | ||
| { | ||
| ev = oEventQ.pop(); | ||
|
|
@@ -677,6 +699,10 @@ void executor::ex_main() | |
| print_report(EV_USR_HASHRATE); | ||
| push_timed_event(ex_event(EV_HASHRATE_LOOP), jconf::inst()->GetAutohashTime()); | ||
| break; | ||
|
|
||
| case EV_USR_POOLRELOAD: | ||
| on_pools_reload(); | ||
| break; | ||
|
|
||
| case EV_INVALID_VAL: | ||
| default: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is not need for the explicit
voidThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed explicit void, however coming from embedded development for mission critical apps i always put void in the func that is not supposed to take any args, but this is in C :)