Implemented dynamic pool reload.
This commit is contained in:
parent
7c789a0d3c
commit
9c088eabc2
5 changed files with 59 additions and 24 deletions
|
@ -47,6 +47,7 @@ xmrig::Network::Network(Controller *controller) :
|
|||
m_donate(nullptr)
|
||||
{
|
||||
Workers::setListener(this);
|
||||
controller->addListener(this);
|
||||
|
||||
const Pools &pools = controller->config()->pools();
|
||||
m_strategy = pools.createStrategy(this);
|
||||
|
@ -64,6 +65,7 @@ xmrig::Network::Network(Controller *controller) :
|
|||
|
||||
xmrig::Network::~Network()
|
||||
{
|
||||
delete m_strategy;
|
||||
}
|
||||
|
||||
|
||||
|
@ -104,6 +106,22 @@ void xmrig::Network::onActive(IStrategy *strategy, Client *client)
|
|||
}
|
||||
|
||||
|
||||
void xmrig::Network::onConfigChanged(Config *config, Config *previousConfig)
|
||||
{
|
||||
if (config->pools() == previousConfig->pools() || !config->pools().active()) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_strategy->stop();
|
||||
|
||||
config->pools().print();
|
||||
|
||||
delete m_strategy;
|
||||
m_strategy = config->pools().createStrategy(this);
|
||||
connect();
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Network::onJob(IStrategy *strategy, Client *client, const Job &job)
|
||||
{
|
||||
if (m_donate && m_donate->isActive() && m_donate != strategy) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue