Prepare for per pool and per job algorithms.
This commit is contained in:
parent
274992e50d
commit
45e8a0525c
14 changed files with 116 additions and 84 deletions
|
@ -26,6 +26,7 @@
|
|||
#include "common/net/Client.h"
|
||||
#include "common/net/Job.h"
|
||||
#include "common/net/strategies/FailoverStrategy.h"
|
||||
#include "common/net/strategies/SinglePoolStrategy.h"
|
||||
#include "common/Platform.h"
|
||||
#include "common/xmrig.h"
|
||||
#include "interfaces/IStrategyListener.h"
|
||||
|
@ -41,7 +42,7 @@ static inline float randomf(float min, float max) {
|
|||
}
|
||||
|
||||
|
||||
DonateStrategy::DonateStrategy(int level, const char *user, int algo, IStrategyListener *listener) :
|
||||
DonateStrategy::DonateStrategy(int level, const char *user, xmrig::Algo algo, IStrategyListener *listener) :
|
||||
m_active(false),
|
||||
m_donateTime(level * 60 * 1000),
|
||||
m_idleTime((100 - level) * 60 * 1000),
|
||||
|
@ -61,14 +62,24 @@ DonateStrategy::DonateStrategy(int level, const char *user, int algo, IStrategyL
|
|||
}
|
||||
else if (algo == xmrig::CRYPTONIGHT_HEAVY) {
|
||||
m_pools.push_back(Pool(kDonatePool1, 8888, userId, nullptr, false, true));
|
||||
m_pools.push_back(Pool(kDonatePool1, 8889, userId, nullptr, false, true));
|
||||
}
|
||||
else if (algo == xmrig::CRYPTONIGHT_IPBC) {
|
||||
m_pools.push_back(Pool(kDonatePool1, 13333, userId, nullptr, false, true));
|
||||
}
|
||||
else {
|
||||
m_pools.push_back(Pool(kDonatePool1, 5555, userId, nullptr, false, true));
|
||||
m_pools.push_back(Pool(kDonatePool1, 7777, userId, nullptr, false, true));
|
||||
}
|
||||
|
||||
m_strategy = new FailoverStrategy(m_pools, 1, 1, this, true);
|
||||
for (Pool &pool : m_pools) {
|
||||
pool.setAlgo(algo);
|
||||
}
|
||||
|
||||
if (m_pools.size() > 1) {
|
||||
m_strategy = new FailoverStrategy(m_pools, 1, 2, this, true);
|
||||
}
|
||||
else {
|
||||
m_strategy = new SinglePoolStrategy(m_pools.front(), 1, this, true);
|
||||
}
|
||||
|
||||
m_timer.data = this;
|
||||
uv_timer_init(uv_default_loop(), &m_timer);
|
||||
|
|
|
@ -43,7 +43,7 @@ class Url;
|
|||
class DonateStrategy : public IStrategy, public IStrategyListener
|
||||
{
|
||||
public:
|
||||
DonateStrategy(int level, const char *user, int algo, IStrategyListener *listener);
|
||||
DonateStrategy(int level, const char *user, xmrig::Algo algo, IStrategyListener *listener);
|
||||
~DonateStrategy();
|
||||
|
||||
public:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue