Sync changes with proxy.

This commit is contained in:
XMRig 2018-05-19 14:44:50 +07:00
parent 6dda4ad41c
commit 14f0e8658c
3 changed files with 39 additions and 20 deletions

View file

@ -30,6 +30,7 @@
#include <vector> #include <vector>
#include "common/crypto/Algorithm.h"
#include "common/net/Id.h" #include "common/net/Id.h"
#include "common/net/Job.h" #include "common/net/Job.h"
#include "common/net/Pool.h" #include "common/net/Pool.h"
@ -73,6 +74,7 @@ public:
inline int id() const { return m_id; } inline int id() const { return m_id; }
inline SocketState state() const { return m_state; } inline SocketState state() const { return m_state; }
inline uint16_t port() const { return m_pool.port(); } inline uint16_t port() const { return m_pool.port(); }
inline void setAlgo(const xmrig::Algorithm &algo) { m_pool.setAlgo(algo); }
inline void setQuiet(bool quiet) { m_quiet = quiet; } inline void setQuiet(bool quiet) { m_quiet = quiet; }
inline void setRetries(int retries) { m_retries = retries; } inline void setRetries(int retries) { m_retries = retries; }
inline void setRetryPause(int ms) { m_retryPause = ms; } inline void setRetryPause(int ms) { m_retryPause = ms; }

View file

@ -247,17 +247,15 @@ void Pool::adjust(xmrig::Algo algorithm)
m_algorithm.setVariant(xmrig::VARIANT_1); m_algorithm.setVariant(xmrig::VARIANT_1);
} }
m_algorithms.push_back(m_algorithm); rebuild();
}
# ifndef XMRIG_PROXY_PROJECT
if (m_algorithm.algo() != xmrig::CRYPTONIGHT_HEAVY) { void Pool::setAlgo(const xmrig::Algorithm &algorithm)
addVariant(xmrig::VARIANT_1); {
addVariant(xmrig::VARIANT_0); m_algorithm = algorithm;
addVariant(xmrig::VARIANT_XTL);
addVariant(xmrig::VARIANT_IPBC); rebuild();
addVariant(xmrig::VARIANT_AUTO);
}
# endif
} }
@ -309,3 +307,20 @@ void Pool::addVariant(xmrig::Variant variant)
m_algorithms.push_back(algorithm); m_algorithms.push_back(algorithm);
} }
void Pool::rebuild()
{
m_algorithms.clear();
m_algorithms.push_back(m_algorithm);
# ifndef XMRIG_PROXY_PROJECT
if (m_algorithm.algo() != xmrig::CRYPTONIGHT_HEAVY) {
addVariant(xmrig::VARIANT_1);
addVariant(xmrig::VARIANT_0);
addVariant(xmrig::VARIANT_XTL);
addVariant(xmrig::VARIANT_IPBC);
addVariant(xmrig::VARIANT_AUTO);
}
# endif
}

View file

@ -78,6 +78,7 @@ public:
bool setUserpass(const char *userpass); bool setUserpass(const char *userpass);
rapidjson::Value toJSON(rapidjson::Document &doc) const; rapidjson::Value toJSON(rapidjson::Document &doc) const;
void adjust(xmrig::Algo algorithm); void adjust(xmrig::Algo algorithm);
void setAlgo(const xmrig::Algorithm &algorithm);
# ifdef APP_DEBUG # ifdef APP_DEBUG
void print() const; void print() const;
@ -86,6 +87,7 @@ public:
private: private:
bool parseIPv6(const char *addr); bool parseIPv6(const char *addr);
void addVariant(xmrig::Variant variant); void addVariant(xmrig::Variant variant);
void rebuild();
bool m_nicehash; bool m_nicehash;
int m_keepAlive; int m_keepAlive;