Rename class Url to Pool.
This commit is contained in:
parent
ad7545d149
commit
36ef254c73
18 changed files with 136 additions and 126 deletions
|
@ -60,17 +60,17 @@ DonateStrategy::DonateStrategy(int level, const char *user, int algo, IStrategyL
|
|||
Job::toHex(hash, 32, userId);
|
||||
|
||||
if (algo == xmrig::CRYPTONIGHT) {
|
||||
m_pools.push_back(new Url(kDonatePool1, 6666, userId, nullptr, false, true));
|
||||
m_pools.push_back(new Url(kDonatePool1, 80, userId, nullptr, false, true));
|
||||
m_pools.push_back(new Url(kDonatePool2, 5555, "48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD", "emergency", false, false));
|
||||
m_pools.push_back(Pool(kDonatePool1, 6666, userId, nullptr, false, true));
|
||||
m_pools.push_back(Pool(kDonatePool1, 80, userId, nullptr, false, true));
|
||||
m_pools.push_back(Pool(kDonatePool2, 5555, "48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD", "emergency", false, false));
|
||||
}
|
||||
else if (algo == xmrig::CRYPTONIGHT_HEAVY) {
|
||||
m_pools.push_back(new Url(kDonatePool1, 8888, userId, nullptr, false, true));
|
||||
m_pools.push_back(new Url(kDonatePool1, 8889, userId, nullptr, false, true));
|
||||
m_pools.push_back(Pool(kDonatePool1, 8888, userId, nullptr, false, true));
|
||||
m_pools.push_back(Pool(kDonatePool1, 8889, userId, nullptr, false, true));
|
||||
}
|
||||
else {
|
||||
m_pools.push_back(new Url(kDonatePool1, 5555, userId, nullptr, false, true));
|
||||
m_pools.push_back(new Url(kDonatePool1, 7777, userId, nullptr, false, true));
|
||||
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);
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "interfaces/IClientListener.h"
|
||||
#include "interfaces/IStrategy.h"
|
||||
#include "interfaces/IStrategyListener.h"
|
||||
#include "net/Pool.h"
|
||||
|
||||
|
||||
class Client;
|
||||
|
@ -71,7 +72,7 @@ private:
|
|||
const int m_idleTime;
|
||||
IStrategy *m_strategy;
|
||||
IStrategyListener *m_listener;
|
||||
std::vector<Url*> m_pools;
|
||||
std::vector<Pool> m_pools;
|
||||
uv_timer_t m_timer;
|
||||
};
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "Platform.h"
|
||||
|
||||
|
||||
FailoverStrategy::FailoverStrategy(const std::vector<Url*> &urls, int retryPause, int retries, IStrategyListener *listener, bool quiet) :
|
||||
FailoverStrategy::FailoverStrategy(const std::vector<Pool> &urls, int retryPause, int retries, IStrategyListener *listener, bool quiet) :
|
||||
m_quiet(quiet),
|
||||
m_retries(retries),
|
||||
m_retryPause(retryPause),
|
||||
|
@ -36,7 +36,7 @@ FailoverStrategy::FailoverStrategy(const std::vector<Url*> &urls, int retryPause
|
|||
m_index(0),
|
||||
m_listener(listener)
|
||||
{
|
||||
for (const Url *url : urls) {
|
||||
for (const Pool &url : urls) {
|
||||
add(url);
|
||||
}
|
||||
}
|
||||
|
@ -153,10 +153,10 @@ void FailoverStrategy::onResultAccepted(Client *client, const SubmitResult &resu
|
|||
}
|
||||
|
||||
|
||||
void FailoverStrategy::add(const Url *url)
|
||||
void FailoverStrategy::add(const Pool &pool)
|
||||
{
|
||||
Client *client = new Client((int) m_pools.size(), Platform::userAgent(), this);
|
||||
client->setUrl(url);
|
||||
client->setUrl(pool);
|
||||
client->setRetryPause(m_retryPause * 1000);
|
||||
client->setQuiet(m_quiet);
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "interfaces/IClientListener.h"
|
||||
#include "interfaces/IStrategy.h"
|
||||
#include "net/Pool.h"
|
||||
|
||||
|
||||
class Client;
|
||||
|
@ -40,7 +41,7 @@ class Url;
|
|||
class FailoverStrategy : public IStrategy, public IClientListener
|
||||
{
|
||||
public:
|
||||
FailoverStrategy(const std::vector<Url*> &urls, int retryPause, int retries, IStrategyListener *listener, bool quiet = false);
|
||||
FailoverStrategy(const std::vector<Pool> &urls, int retryPause, int retries, IStrategyListener *listener, bool quiet = false);
|
||||
~FailoverStrategy();
|
||||
|
||||
public:
|
||||
|
@ -59,7 +60,7 @@ protected:
|
|||
void onResultAccepted(Client *client, const SubmitResult &result, const char *error) override;
|
||||
|
||||
private:
|
||||
void add(const Url *url);
|
||||
void add(const Pool &pool);
|
||||
|
||||
const bool m_quiet;
|
||||
const int m_retries;
|
||||
|
|
|
@ -28,12 +28,12 @@
|
|||
#include "Platform.h"
|
||||
|
||||
|
||||
SinglePoolStrategy::SinglePoolStrategy(const Url *url, int retryPause, IStrategyListener *listener, bool quiet) :
|
||||
SinglePoolStrategy::SinglePoolStrategy(const Pool &pool, int retryPause, IStrategyListener *listener, bool quiet) :
|
||||
m_active(false),
|
||||
m_listener(listener)
|
||||
{
|
||||
m_client = new Client(0, Platform::userAgent(), this);
|
||||
m_client->setUrl(url);
|
||||
m_client->setUrl(pool);
|
||||
m_client->setRetryPause(retryPause * 1000);
|
||||
m_client->setQuiet(quiet);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class Url;
|
|||
class SinglePoolStrategy : public IStrategy, public IClientListener
|
||||
{
|
||||
public:
|
||||
SinglePoolStrategy(const Url *url, int retryPause, IStrategyListener *listener, bool quiet = false);
|
||||
SinglePoolStrategy(const Pool &pool, int retryPause, IStrategyListener *listener, bool quiet = false);
|
||||
~SinglePoolStrategy();
|
||||
|
||||
public:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue