#1202 Fixed algorithm verification in donate strategy.
This commit is contained in:
parent
e66eeefb14
commit
680081b93b
5 changed files with 41 additions and 34 deletions
|
@ -24,7 +24,7 @@
|
|||
|
||||
|
||||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
#include <cassert>
|
||||
#include <iterator>
|
||||
|
||||
|
||||
|
@ -58,17 +58,10 @@ static const char *kDonateHostTls = "donate.ssl.xmrig.com";
|
|||
|
||||
|
||||
xmrig::DonateStrategy::DonateStrategy(Controller *controller, IStrategyListener *listener) :
|
||||
m_tls(false),
|
||||
m_userId(),
|
||||
m_donateTime(static_cast<uint64_t>(controller->config()->pools().donateLevel()) * 60 * 1000),
|
||||
m_idleTime((100 - static_cast<uint64_t>(controller->config()->pools().donateLevel())) * 60 * 1000),
|
||||
m_controller(controller),
|
||||
m_proxy(nullptr),
|
||||
m_strategy(nullptr),
|
||||
m_listener(listener),
|
||||
m_state(STATE_NEW),
|
||||
m_now(0),
|
||||
m_timestamp(0)
|
||||
m_listener(listener)
|
||||
{
|
||||
uint8_t hash[200];
|
||||
|
||||
|
@ -77,15 +70,15 @@ xmrig::DonateStrategy::DonateStrategy(Controller *controller, IStrategyListener
|
|||
Buffer::toHex(hash, 32, m_userId);
|
||||
|
||||
# ifdef XMRIG_FEATURE_TLS
|
||||
m_pools.push_back(Pool(kDonateHostTls, 443, m_userId, nullptr, 0, true, true));
|
||||
m_pools.emplace_back(kDonateHostTls, 443, m_userId, nullptr, 0, true, true);
|
||||
# endif
|
||||
m_pools.push_back(Pool(kDonateHost, 3333, m_userId, nullptr, 0, true));
|
||||
m_pools.emplace_back(kDonateHost, 3333, m_userId, nullptr, 0, true);
|
||||
|
||||
if (m_pools.size() > 1) {
|
||||
m_strategy = new FailoverStrategy(m_pools, 1, 2, this, true);
|
||||
m_strategy = new FailoverStrategy(m_pools, 10, 2, this, true);
|
||||
}
|
||||
else {
|
||||
m_strategy = new SinglePoolStrategy(m_pools.front(), 1, 2, this, true);
|
||||
m_strategy = new SinglePoolStrategy(m_pools.front(), 10, 2, this, true);
|
||||
}
|
||||
|
||||
m_timer = new Timer(this);
|
||||
|
@ -223,6 +216,18 @@ void xmrig::DonateStrategy::onLoginSuccess(IClient *client)
|
|||
}
|
||||
|
||||
|
||||
void xmrig::DonateStrategy::onVerifyAlgorithm(const IClient *client, const Algorithm &algorithm, bool *ok)
|
||||
{
|
||||
m_listener->onVerifyAlgorithm(this, client, algorithm, ok);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::DonateStrategy::onVerifyAlgorithm(IStrategy *, const IClient *client, const Algorithm &algorithm, bool *ok)
|
||||
{
|
||||
m_listener->onVerifyAlgorithm(this, client, algorithm, ok);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::DonateStrategy::onTimer(const Timer *)
|
||||
{
|
||||
setState(isActive() ? STATE_WAIT : STATE_CONNECT);
|
||||
|
@ -246,7 +251,7 @@ xmrig::Client *xmrig::DonateStrategy::createProxy()
|
|||
Pool pool(client->ip(), client->pool().port(), m_userId, client->pool().password(), 0, true, client->isTLS());
|
||||
pool.setAlgo(client->pool().algorithm());
|
||||
|
||||
Client *proxy = new Client(-1, Platform::userAgent(), this);
|
||||
auto proxy = new Client(-1, Platform::userAgent(), this);
|
||||
proxy->setPool(pool);
|
||||
proxy->setQuiet(true);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue