Restored algo field in login request.
This commit is contained in:
parent
f590cf58fb
commit
0ab26a1619
14 changed files with 129 additions and 35 deletions
|
@ -62,17 +62,46 @@ public:
|
|||
}
|
||||
|
||||
|
||||
bool isEnabled(const Algorithm &algorithm) const
|
||||
{
|
||||
for (IBackend *backend : backends) {
|
||||
if (backend->isEnabled(algorithm)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
inline void rebuild()
|
||||
{
|
||||
algorithms.clear();
|
||||
|
||||
for (int i = 0; i < Algorithm::MAX; ++i) {
|
||||
const Algorithm algo(static_cast<Algorithm::Id>(i));
|
||||
|
||||
if (isEnabled(algo)) {
|
||||
algorithms.push_back(algo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline void handleJobChange()
|
||||
{
|
||||
active = true;
|
||||
if (enabled) {
|
||||
Nonce::pause(false);;
|
||||
}
|
||||
|
||||
for (IBackend *backend : backends) {
|
||||
backend->setJob(job);
|
||||
}
|
||||
|
||||
if (enabled) {
|
||||
Nonce::pause(false);;
|
||||
}
|
||||
|
||||
Nonce::reset(job.index());
|
||||
|
||||
if (ticks == 0) {
|
||||
ticks++;
|
||||
timer->start(500, 500);
|
||||
|
@ -80,6 +109,7 @@ public:
|
|||
}
|
||||
|
||||
|
||||
Algorithms algorithms;
|
||||
bool active = false;
|
||||
bool enabled = true;
|
||||
Controller *controller;
|
||||
|
@ -104,6 +134,8 @@ xmrig::Miner::Miner(Controller *controller)
|
|||
d_ptr->timer = new Timer(this);
|
||||
|
||||
d_ptr->backends.push_back(new CpuBackend(controller));
|
||||
|
||||
d_ptr->rebuild();
|
||||
}
|
||||
|
||||
|
||||
|
@ -119,6 +151,12 @@ bool xmrig::Miner::isEnabled() const
|
|||
}
|
||||
|
||||
|
||||
const xmrig::Algorithms &xmrig::Miner::algorithms() const
|
||||
{
|
||||
return d_ptr->algorithms;
|
||||
}
|
||||
|
||||
|
||||
const std::vector<xmrig::IBackend *> &xmrig::Miner::backends() const
|
||||
{
|
||||
return d_ptr->backends;
|
||||
|
@ -202,8 +240,6 @@ void xmrig::Miner::setJob(const Job &job, bool donate)
|
|||
d_ptr->job = job;
|
||||
d_ptr->job.setIndex(index);
|
||||
|
||||
Nonce::reset(index);
|
||||
|
||||
uv_rwlock_wrunlock(&d_ptr->rwlock);
|
||||
|
||||
d_ptr->handleJobChange();
|
||||
|
@ -222,6 +258,8 @@ void xmrig::Miner::stop()
|
|||
|
||||
void xmrig::Miner::onConfigChanged(Config *config, Config *previousConfig)
|
||||
{
|
||||
d_ptr->rebuild();
|
||||
|
||||
if (config->pools() != previousConfig->pools() && config->pools().active() > 0) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "base/kernel/interfaces/IBaseListener.h"
|
||||
#include "base/kernel/interfaces/ITimerListener.h"
|
||||
#include "crypto/common/Algorithm.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
@ -49,6 +50,7 @@ public:
|
|||
~Miner() override;
|
||||
|
||||
bool isEnabled() const;
|
||||
const Algorithms &algorithms() const;
|
||||
const std::vector<IBackend *> &backends() const;
|
||||
Job job() const;
|
||||
void pause();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue