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 "common/crypto/Algorithm.h"
#include "common/net/Id.h"
#include "common/net/Job.h"
#include "common/net/Pool.h"
@ -66,16 +67,17 @@ public:
void setPool(const Pool &pool);
void tick(uint64_t now);
inline bool isReady() const { return m_state == ConnectedState && m_failures == 0; }
inline const char *host() const { return m_pool.host(); }
inline const char *ip() const { return m_ip; }
inline const Job &job() const { return m_job; }
inline int id() const { return m_id; }
inline SocketState state() const { return m_state; }
inline uint16_t port() const { return m_pool.port(); }
inline void setQuiet(bool quiet) { m_quiet = quiet; }
inline void setRetries(int retries) { m_retries = retries; }
inline void setRetryPause(int ms) { m_retryPause = ms; }
inline bool isReady() const { return m_state == ConnectedState && m_failures == 0; }
inline const char *host() const { return m_pool.host(); }
inline const char *ip() const { return m_ip; }
inline const Job &job() const { return m_job; }
inline int id() const { return m_id; }
inline SocketState state() const { return m_state; }
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 setRetries(int retries) { m_retries = retries; }
inline void setRetryPause(int ms) { m_retryPause = ms; }
private:
enum Extensions {

View file

@ -247,17 +247,15 @@ void Pool::adjust(xmrig::Algo algorithm)
m_algorithm.setVariant(xmrig::VARIANT_1);
}
m_algorithms.push_back(m_algorithm);
rebuild();
}
# 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
void Pool::setAlgo(const xmrig::Algorithm &algorithm)
{
m_algorithm = algorithm;
rebuild();
}
@ -309,3 +307,20 @@ void Pool::addVariant(xmrig::Variant variant)
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);
rapidjson::Value toJSON(rapidjson::Document &doc) const;
void adjust(xmrig::Algo algorithm);
void setAlgo(const xmrig::Algorithm &algorithm);
# ifdef APP_DEBUG
void print() const;
@ -86,6 +87,7 @@ public:
private:
bool parseIPv6(const char *addr);
void addVariant(xmrig::Variant variant);
void rebuild();
bool m_nicehash;
int m_keepAlive;